Skip to content

Commit

Permalink
Fix api mocking
Browse files Browse the repository at this point in the history
Mock requesting function "contents()"
Actual request was returning none, but still performing request
  • Loading branch information
mfraezz committed Jan 20, 2015
1 parent 83144e8 commit 8213755
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions website/addons/github/tests/webtest_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ def test_can_see_files_tab(self, mock_repo, mock_file, mock_commits):
@mock.patch('website.addons.github.api.GitHub.commits')
@mock.patch('website.addons.github.api.GitHub.file')
@mock.patch('website.addons.github.api.GitHub.repo')
def test_file_view(self, mock_repo, mock_file, mock_commits):
@mock.patch('website.addons.github.api.GitHub.contents')
def test_file_view(self, mock_contents, mock_repo, mock_file, mock_commits):
mock_contents.return_value = None
mock_commits.return_value = [Commit.from_json({
"url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
Expand Down Expand Up @@ -119,7 +121,9 @@ def test_file_view(self, mock_repo, mock_file, mock_commits):
@mock.patch('website.addons.github.api.GitHub.commits')
@mock.patch('website.addons.github.api.GitHub.file')
@mock.patch('website.addons.github.api.GitHub.repo')
def test_file_view_deleted(self, mock_repo, mock_file, mock_commits):
@mock.patch('website.addons.github.api.GitHub.contents')
def test_file_view_deleted(self, mock_contents, mock_repo, mock_file, mock_commits):
mock_contents.return_value = None
mock_commits.return_value = [Commit.from_json({
"url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
Expand Down Expand Up @@ -164,7 +168,9 @@ def test_file_view_deleted(self, mock_repo, mock_file, mock_commits):
@mock.patch('website.addons.github.api.GitHub.commits')
@mock.patch('website.addons.github.api.GitHub.file')
@mock.patch('website.addons.github.api.GitHub.repo')
def test_file_view_with_anonymous_link(self, mock_repo, mock_file, mock_commits):
@mock.patch('website.addons.github.api.GitHub.contents')
def test_file_view_with_anonymous_link(self, mock_contents, mock_repo, mock_file, mock_commits):
mock_contents.return_value = None
mock_commits.return_value = [Commit.from_json({
"url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
Expand Down

0 comments on commit 8213755

Please sign in to comment.