def test_post_to_bugzilla_same_branch_separate_commits(self): """ If separate commits (pushed later) on the branch reference the same bug we are not going to add a comment for it. Bug 999999 already has a comment for the master branch. """ data = """ { "ref":"refs/heads/master", "repository": { "html_url": "https://github.com/Codertocat" }, "commits":[ { "id":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "url":"https://github.com/atodorov/bztest/commit/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "message":"Commit on another branch\\n\\nResolves: rhbz#999999", "timestamp":"2015-10-23T13:18:47+03:00", "author": { "name":"Alexander Todorov", "email":"*****@*****.**", "username":"******" } } ] } """ data = json.loads(data) posts = wsgi.post_to_bugzilla(FakeBugzilla(), data) self.assertEqual(posts, 0)
def test_post_to_bugzilla_same_branch_separate_commits(self): """ If separate commits (pushed later) on the branch reference the same bug we are not going to add a comment for it. Bug 999999 already has a comment for the master branch. """ data = """ { "ref":"refs/heads/master", "commits":[ { "id":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "url":"https://github.com/atodorov/bztest/commit/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "message":"Commit on another branch\\n\\nResolves: rhbz#999999", "timestamp":"2015-10-23T13:18:47+03:00", "author": { "name":"Alexander Todorov", "email":"*****@*****.**", "username":"******" } } ] } """ data = json.loads(data) posts = wsgi.post_to_bugzilla(FakeBugzilla(), data) self.assertEqual(posts, 0)
def test_post_to_bugzilla_2_branches_same_bug(self): """ If a commit on another branch references the same bug we have to add a comment for it. Bug 999999 already has a comment for the master branch. """ data = """ { "ref":"refs/heads/new_branch", "commits":[ { "id":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "url":"https://github.com/atodorov/bztest/commit/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "message":"Commit on another branch\\n\\nResolves: rhbz#999999", "timestamp":"2015-10-23T13:18:47+03:00", "author": { "name":"Alexander Todorov", "email":"*****@*****.**", "username":"******" } } ] } """ data = json.loads(data) posts = wsgi.post_to_bugzilla(FakeBugzilla(), data) self.assertEqual(posts, 1)
def test_post_to_bugzilla(self): """ - Bug 999999 already has a comment on it so don't post a new one, - Bug 123456 doesn't have any comments from us so update it """ posts = wsgi.post_to_bugzilla(FakeBugzilla(), self.data) # comment posted only for bug 123456 self.assertEqual(posts, 1)