File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -551,6 +551,13 @@ def _test8Attachments(self):
551551 setbug .refresh ()
552552 assert setbug .attachments [- 1 ]["flags" ] == []
553553
554+ # Set attachment obsolete
555+ bz ._proxy .Bug .update_attachment ({ # pylint: disable=protected-access
556+ "ids" : [setbug .attachments [- 1 ]["id" ]],
557+ "is_obsolete" : 1 })
558+ setbug .refresh ()
559+ assert setbug .attachments [- 1 ]["is_obsolete" ] == 1
560+
554561
555562 # Get attachment, verify content
556563 out = tests .clicomm (cmd + "--get %s" % attachid , bz ).splitlines ()
@@ -578,6 +585,18 @@ def _test8Attachments(self):
578585 raise AssertionError ("filename '%s' not found" % f )
579586 os .unlink (f )
580587
588+ # Get all attachments, but ignore obsolete
589+ ignorecmd = cmd + "--getall %s --ignore-obsolete" % getbug .id
590+ out = tests .clicomm (ignorecmd , bz ).splitlines ()
591+
592+ assert len (out ) == (numattach + 1 )
593+ fnames = [l .split (" " , 1 )[1 ].strip () for l in out [2 :]]
594+ assert len (fnames ) == (numattach - 1 )
595+ for f in fnames :
596+ if not os .path .exists (f ):
597+ raise AssertionError ("filename '%s' not found" % f )
598+ os .unlink (f )
599+
581600
582601 def test09Whiteboards (self ):
583602 bz = self .bzclass (url = self .url )
You can’t perform that action at this time.
0 commit comments