Skip to content
This repository has been archived by the owner on Jun 17, 2023. It is now read-only.

Commit

Permalink
Integration test for duplicate comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
justinabrahms committed Feb 22, 2014
1 parent 1811f91 commit 2d562f4
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion imhotep/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,28 @@ def test_github_post():
finally:
for comment in comments:
req.delete('https://api.github.com/repos/%s/pulls/comments/%s' % (
repo, comment['id']))
repo, comment['id']))


@require_github_creds
def test_dont_post_duplicate_comments():
repo = 'imhotepbot/sacrificial-integration-tests'
pr = 1
test_str = 'integration test error name'
req = GithubRequester(ghu, ghp)
r = PRReporter(req, pr)
args = [repo, 'da6a127', 'foo.py', 2, 3, test_str]

r.report_line(*args)
r.report_line(*args) # should dedupe.

comment_url = 'https://api.github.com/repos/%s/pulls/%s/comments' % (
repo, pr)
comments = req.get(comment_url).json
posted = [x for x in comments if test_str in x['body']]

try:
assert len(posted) == 1
finally:
for comment in comments:
req.delete('%s/%s' % (comment_url, comment['id']))

0 comments on commit 2d562f4

Please sign in to comment.