Skip to content

Commit 5b14656

Browse files
authored
Merge pull request #2309 from antgonza/delete-study-with-tags
Delete study with tags
2 parents 4a30c79 + b9ce206 commit 5b14656

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

qiita_db/study.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,9 @@ def delete(cls, id_):
440440
sql = "DELETE FROM qiita.investigation_study WHERE study_id = %s"
441441
qdb.sql_connection.TRN.add(sql, args)
442442

443+
sql = "DELETE FROM qiita.per_study_tags WHERE study_id = %s"
444+
qdb.sql_connection.TRN.add(sql, args)
445+
443446
sql = "DELETE FROM qiita.study WHERE study_id = %s"
444447
qdb.sql_connection.TRN.add(sql, args)
445448

qiita_ware/test/test_private_plugin.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434

3535
class BaseTestPrivatePlugin(TestCase):
3636
def _create_job(self, cmd_name, values_dict):
37-
user = User('test@foo.bar')
37+
self.user = User('test@foo.bar')
3838
qiita_plugin = Software.from_name_and_version('Qiita', 'alpha')
3939
cmd = qiita_plugin.get_command(cmd_name)
4040
params = Parameters.load(cmd, values_dict=values_dict)
41-
job = ProcessingJob.create(user, params)
41+
job = ProcessingJob.create(self.user, params)
4242
job._set_status('queued')
4343
return job
4444

@@ -389,13 +389,17 @@ def test_delete_study(self):
389389
"submitted to EBI", job.log.msg)
390390

391391
# delete everything from the EBI submissions and the processing job so
392-
# we can try again: test success
392+
# we can try again: test success (with tags)
393393
with TRN:
394394
sql = """DELETE FROM qiita.ebi_run_accession"""
395395
TRN.add(sql)
396396
sql = """DELETE FROM qiita.artifact_processing_job"""
397397
TRN.add(sql)
398398
TRN.execute()
399+
400+
# adding tags
401+
Study(1).update_tags(self.user, ['my new tag!'])
402+
399403
job = self._create_job('delete_study', {'study': 1})
400404
private_task(job.id)
401405

0 commit comments

Comments
 (0)