Skip to content

Commit 3e5b2a3

Browse files
committed
tests: Add --ignore-obsolete test
Signed-off-by: Cole Robinson <[email protected]>
1 parent b5d7815 commit 3e5b2a3

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

tests/test_rw_functional.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)