示例#1
0
文件: test_bugs.py 项目: pyoor/Bugsy
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'
示例#2
0
文件: test_bugs.py 项目: pyoor/Bugsy
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'
示例#3
0
def test_we_cant_update_unless_we_have_a_bug_id():
    bug = Bug()
    try:
        bug.update()
    except BugException as e:
        assert str(
            e
        ) == "Message: Unable to update bug that isn't in Bugzilla Code: None"
示例#4
0
def test_we_cant_update_unless_we_have_a_bug_id():
    bug = Bug()
    try:
        bug.update()
    except BugException as e:
        assert str(e) == "Message: Unable to update bug that isn't in Bugzilla"