File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -364,6 +364,9 @@ def delete(cls, id_):
364364 """
365365 cls ._check_subclass ()
366366
367+ # checking that the id_ exists
368+ cls (id_ )
369+
367370 conn_handler = SQLConnectionHandler ()
368371 if exists_table ('sample_%d' % id_ , conn_handler ):
369372 raise QiitaDBError ('Study "%s" cannot be erased because it has a '
Original file line number Diff line number Diff line change 1212from qiita_db .data import RawData
1313from qiita_db .util import convert_to_id
1414from qiita_db .exceptions import (
15- QiitaDBColumnError , QiitaDBStatusError , QiitaDBError )
15+ QiitaDBColumnError , QiitaDBStatusError , QiitaDBError ,
16+ QiitaDBUnknownIDError )
1617
1718# -----------------------------------------------------------------------------
1819# Copyright (c) 2014--, The Qiita Development Team.
@@ -448,6 +449,9 @@ def test_delete(self):
448449 with self .assertRaises (QiitaDBError ):
449450 Study .delete (1 )
450451
452+ with self .assertRaises (QiitaDBUnknownIDError ):
453+ Study .delete (41 )
454+
451455 def test_retrieve_title (self ):
452456 self .assertEqual (self .study .title , 'Identification of the Microbiomes'
453457 ' for Cannabis Soils' )
You can’t perform that action at this time.
0 commit comments