From d14691e45d6bef75225b047c4e65ee02834c5c3d Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 27 2015 12:57:30 +0000 Subject: Expand the add_issue_assignee unit-tests --- diff --git a/tests/test_progitlib.py b/tests/test_progitlib.py index b223a50..a6b2816 100644 --- a/tests/test_progitlib.py +++ b/tests/test_progitlib.py @@ -313,6 +313,17 @@ class ProgitLibtests(tests.Modeltests): self.session, repo, assignee='pingou') self.assertEqual(len(issues), 0) + # Set the assignee by its email + msg = progit.lib.add_issue_assignee( + session=self.session, + issue=issue, + assignee='foo@bar.com', + user='pingou', + ticketfolder=None) + self.session.commit() + self.assertEqual(msg, 'Issue assigned') + + # Change the assignee to someone else by its username msg = progit.lib.add_issue_assignee( session=self.session, issue=issue, @@ -349,6 +360,26 @@ class ProgitLibtests(tests.Modeltests): self.assertEqual(issues[0].status, 'Open') self.assertEqual(issues[0].tags, []) + # Reset the assignee to no-one + msg = progit.lib.add_issue_assignee( + session=self.session, + issue=issue, + assignee=None, + user='pingou', + ticketfolder=None) + self.session.commit() + self.assertEqual(msg, 'Assignee reset') + + issues = progit.lib.search_issues( + self.session, repo, assignee=False) + self.assertEqual(len(issues), 2) + self.assertEqual(issues[0].id, 1) + self.assertEqual(issues[1].id, 2) + + issues = progit.lib.search_issues( + self.session, repo, assignee=True) + self.assertEqual(len(issues), 0) + if __name__ == '__main__': SUITE = unittest.TestLoader().loadTestsFromTestCase(ProgitLibtests)