本文整理汇总了Python中bugsy.Bugsy.put方法的典型用法代码示例。如果您正苦于以下问题:Python Bugsy.put方法的具体用法?Python Bugsy.put怎么用?Python Bugsy.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bugsy.Bugsy
的用法示例。
在下文中一共展示了Bugsy.put方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_that_we_can_add_a_comment_to_a_bug_before_it_is_put
# 需要导入模块: from bugsy import Bugsy [as 别名]
# 或者: from bugsy.Bugsy import put [as 别名]
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)
示例2: test_we_cant_post_without_a_username_or_password
# 需要导入模块: from bugsy import Bugsy [as 别名]
# 或者: from bugsy.Bugsy import put [as 别名]
def test_we_cant_post_without_a_username_or_password():
bugzilla = Bugsy()
try:
bugzilla.put("foo")
assert 1 == 0, "Should have thrown when calling put"
except BugsyException as e:
assert str(e) == "Message: Unfortunately you can't put bugs in Bugzilla without credentials"
示例3: test_we_cant_post_without_passing_a_bug_object
# 需要导入模块: from bugsy import Bugsy [as 别名]
# 或者: from bugsy.Bugsy import put [as 别名]
def test_we_cant_post_without_passing_a_bug_object():
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)
bugzilla = Bugsy("foo", "bar")
try:
bugzilla.put("foo")
assert 1 == 0, "Should have thrown an error about type when calling put"
except BugsyException as e:
assert str(e) == "Message: Please pass in a Bug object when posting to Bugzilla"
示例4: test_we_can_create_a_new_remote_bug
# 需要导入模块: from bugsy import Bugsy [as 别名]
# 或者: from bugsy.Bugsy import put [as 别名]
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
示例5: test_we_handle_errors_from_bugzilla_when_posting
# 需要导入模块: from bugsy import Bugsy [as 别名]
# 或者: from bugsy.Bugsy import put [as 别名]
def test_we_handle_errors_from_bugzilla_when_posting():
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.POST, 'https://bugzilla.mozilla.org/rest/bug',
body='{"error":true,"code":50,"message":"You must select/enter a component."}', status=200,
content_type='application/json')
bugzilla = Bugsy("foo", "bar")
bug = Bug()
try:
bugzilla.put(bug)
assert 1 == 0, "Put should have raised an error"
except BugsyException as e:
assert str(e) == "Message: You must select/enter a component."
示例6: test_we_handle_errors_from_bugzilla_when_updating_a_bug
# 需要导入模块: from bugsy import Bugsy [as 别名]
# 或者: from bugsy.Bugsy import put [as 别名]
def test_we_handle_errors_from_bugzilla_when_updating_a_bug():
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.POST, 'https://bugzilla.mozilla.org/rest/bug/1017315',
body='{"error":true,"code":50,"message":"You must select/enter a component."}', status=200,
content_type='application/json')
bugzilla = Bugsy("foo", "bar")
bug_dict = example_return.copy()
bug_dict['summary'] = 'I love foo but hate bar'
bug = Bug(**bug_dict['bugs'][0])
try:
bugzilla.put(bug)
except BugsyException as e:
assert str(e) == "Message: You must select/enter a component."
示例7: test_we_can_put_a_current_bug
# 需要导入模块: from bugsy import Bugsy [as 别名]
# 或者: from bugsy.Bugsy import put [as 别名]
def test_we_can_put_a_current_bug():
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 = example_return.copy()
bug_dict['summary'] = 'I love foo but hate bar'
responses.add(responses.POST, 'https://bugzilla.mozilla.org/rest/bug/1017315',
body=json.dumps(bug_dict), status=200,
content_type='application/json')
bugzilla = Bugsy("foo", "bar")
bug = Bug(**example_return['bugs'][0])
bug.summary = 'I love foo but hate bar'
bugzilla.put(bug)
assert bug.summary == 'I love foo but hate bar'
示例8: test_that_we_can_add_a_comment_to_a_bug
# 需要导入模块: from bugsy import Bugsy [as 别名]
# 或者: from bugsy.Bugsy import put [as 别名]
def test_that_we_can_add_a_comment_to_a_bug():
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',
body=json.dumps(example_return), status=200,
content_type='application/json', match_querystring=True)
bugzilla = Bugsy("foo", "bar")
bug = bugzilla.get(1017315)
bug.add_comment("I like sausages")
responses.add(responses.POST, 'https://bugzilla.mozilla.org/rest/bug/1017315?token=foobar',
body=json.dumps(example_return), status=200,
content_type='application/json', match_querystring=True)
bugzilla.put(bug)
示例9: test_we_can_put_a_current_bug
# 需要导入模块: from bugsy import Bugsy [as 别名]
# 或者: from bugsy.Bugsy import put [as 别名]
def test_we_can_put_a_current_bug():
responses.add(responses.GET, 'https://bugzilla.mozilla.org/rest/login',
body='{"token": "foobar"}', status=200,
content_type='application/json', match_querystring=True)
bug_dict = example_return.copy()
bug_dict['summary'] = 'I love foo but hate bar'
responses.add(responses.PUT, 'https://bugzilla.mozilla.org/rest/bug/1017315',
body=json.dumps(bug_dict), status=200,
content_type='application/json')
responses.add(responses.GET, rest_url('bug', 1017315),
body=json.dumps(example_return), status=200,
content_type='application/json', match_querystring=True)
bugzilla = Bugsy("foo", "bar")
bug = Bug(**example_return['bugs'][0])
bug.summary = 'I love foo but hate bar'
bug.assigned_to = "[email protected]"
bugzilla.put(bug)
assert bug.summary == 'I love foo but hate bar'
assert bug.assigned_to == "[email protected]"