def test_we_throw_an_error_for_invalid_status_types(): bug = Bug(**example_return['bugs'][0]) try: bug.status = "foo" assert 1 == 0, "Should have thrown an error about invalid type" except BugException as e: assert str(e) == "Message: Invalid status type was used Code: None"
def test_we_throw_an_error_for_invalid_status_types(): bug = Bug(**example_return['bugs'][0]) try: bug.status = "foo" assert 1 == 0, "Should have thrown an error about invalid type" except BugException as e: assert str(e) == "Message: Invalid status type was used"
def test_bug_update_updates_copy_dict(bug_return, comments_return): responses.add(responses.GET, 'https://bugzilla.mozilla.org/rest/login', body='{"token": "foobar"}', status=200, content_type='application/json', match_querystring=True) bugzilla = Bugsy("foo", "bar") bug = Bug(bugzilla, **bug_return['bugs'][0]) bug.status = 'NEW' diff = bug.diff() bug_dict = copy.deepcopy(bug_return) bug_dict['bugs'][0]['status'] = 'NEW' responses.add(responses.GET, 'https://bugzilla.mozilla.org/rest/bug/1017315', body=json.dumps(bug_dict), status=200, content_type='application/json') responses.add(responses.PUT, 'https://bugzilla.mozilla.org/rest/bug/1017315', body=json.dumps(diff), status=200, content_type='application/json') bugzilla.put(bug) bug.update() assert bug._copy['status'] == 'NEW'
def test_we_can_update_a_bug_with_login_token(bug_return): responses.add(responses.GET, 'https://bugzilla.mozilla.org/rest/login', body='{"token": "foobar"}', status=200, content_type='application/json', match_querystring=True) responses.add(responses.GET, rest_url('bug', 1017315), body=json.dumps(bug_return), status=200, content_type='application/json', match_querystring=True) bugzilla = Bugsy() bug = bugzilla.get(1017315) responses.reset() responses.add(responses.GET, 'https://bugzilla.mozilla.org/rest/bug/1017315', body=json.dumps(bug_return), status=200, content_type='application/json') clone = Bug(bugsy=bugzilla, **bug.to_dict()) clone.status = 'NEW' clone.update() assert clone.id == 1017315 assert clone.status == 'RESOLVED'
def test_we_cant_set_status_unless_there_is_a_bug_id(): bug = Bug() try: bug.status = 'RESOLVED' except BugException as e: assert str( e ) == "Message: Can not set status unless there is a bug id. Please call Update() before setting Code: None"
def test_we_cant_set_status_unless_there_is_a_bug_id(): bug = Bug() try: bug.status = "RESOLVED" except BugException as e: assert ( str(e) == "Message: Can not set status unless there is a bug id. Please call Update() before setting Code: None" )