def test_that_we_can_add_a_comment_to_a_bug_before_it_is_put(): responses.add( responses.GET, "https://bugzilla.mozilla.org/rest/login?login=foo&password=bar", body='{"token": "foobar"}', status=200, content_type="application/json", match_querystring=True, ) responses.add( responses.GET, "https://bugzilla.mozilla.org/rest/bug/1017315?token=foobar&include_fields=version&include_fields=id&include_fields=summary&include_fields=status&include_fields=op_sys&include_fields=resolution&include_fields=product&include_fields=component&include_fields=platform", body=json.dumps(example_return), status=200, content_type="application/json", match_querystring=True, ) bugzilla = Bugsy("foo", "bar") bug = Bug() bug.summary = "I like cheese" bug.add_comment("I like sausages") bug_dict = bug.to_dict().copy() bug_dict["id"] = 123123 responses.add( responses.POST, "https://bugzilla.mozilla.org/rest/bug?token=foobar", body=json.dumps(bug_dict), status=200, content_type="application/json", match_querystring=True, ) bugzilla.put(bug)
def test_that_we_can_add_a_comment_to_a_bug_before_it_is_put(): 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, 'https://bugzilla.mozilla.org/rest/bug/1017315?include_fields=version&include_fields=id&include_fields=summary&include_fields=status&include_fields=op_sys&include_fields=resolution&include_fields=product&include_fields=component&include_fields=platform', body=json.dumps(example_return), status=200, content_type='application/json', match_querystring=True) bugzilla = Bugsy("foo", "bar") bug = Bug() bug.summary = "I like cheese" bug.add_comment("I like sausages") bug_dict = bug.to_dict().copy() bug_dict['id'] = 123123 responses.add(responses.POST, 'https://bugzilla.mozilla.org/rest/bug', body=json.dumps(bug_dict), status=200, content_type='application/json', match_querystring=True) bugzilla.put(bug)
def test_we_can_create_a_new_remote_bug(): bug = Bug() bug.summary = "I like foo" responses.add(responses.GET, 'https://bugzilla.mozilla.org/rest/login?login=foo&password=bar', body='{"token": "foobar"}', status=200, content_type='application/json', match_querystring=True) bug_dict = bug.to_dict().copy() bug_dict['id'] = 123123 responses.add(responses.POST, 'https://bugzilla.mozilla.org/rest/bug', body=json.dumps(bug_dict), status=200, content_type='application/json') bugzilla = Bugsy("foo", "bar") bugzilla.put(bug) assert bug.id != None
def test_we_can_get_a_dict_version_of_the_bug(): bug = Bug(**example_return['bugs'][0]) result = bug.to_dict() assert example_return['bugs'][0]['id'] == result['id']
def test_we_can_get_a_dict_version_of_the_bug(): bug = Bug(**example_return["bugs"][0]) result = bug.to_dict() assert example_return["bugs"][0]["id"] == result["id"]