Fixed conflict.

This commit is contained in:
NotoriousRebel
2020-02-13 17:08:25 -05:00
2 changed files with 9 additions and 8 deletions
+8 -7
View File
@@ -74,44 +74,45 @@ class TestSearchGithubCode:
async def test_fragments_from_response(self):
Core.github_key = MagicMock(return_value="lol")
test_class_instance = githubcode.SearchGithubCode(word="test", limit=500)
test_result = await test_class_instance.fragments_from_response(self.OkResponse.response)
test_result = await test_class_instance.fragments_from_response(self.OkResponse.response.json())
print('test_result: ', test_result)
assert test_result == ["test1", "test2"]
async def test_invalid_fragments_from_response(self):
Core.github_key = MagicMock(return_value="lol")
test_class_instance = githubcode.SearchGithubCode(word="test", limit=500)
test_result = test_class_instance.fragments_from_response(self.MalformedResponse.response)
test_result = await test_class_instance.fragments_from_response(self.MalformedResponse.response.json())
assert test_result == []
async def test_handle_response_ok(self):
Core.github_key = MagicMock(return_value="lol")
test_class_instance = githubcode.SearchGithubCode(word="test", limit=500)
test_result = test_class_instance.handle_response(self.OkResponse.response)
test_result = await test_class_instance.handle_response()
assert isinstance(test_result, SuccessResult)
async def test_handle_response_retry(self):
Core.github_key = MagicMock(return_value="lol")
test_class_instance = githubcode.SearchGithubCode(word="test", limit=500)
test_result = test_class_instance.handle_response(self.RetryResponse.response)
test_result = await test_class_instance.handle_response(self.RetryResponse.response.json())
assert isinstance(test_result, RetryResult)
async def test_handle_response_fail(self):
Core.github_key = MagicMock(return_value="lol")
test_class_instance = githubcode.SearchGithubCode(word="test", limit=500)
test_result = test_class_instance.handle_response(self.FailureResponse.response)
test_result = await test_class_instance.handle_response(self.FailureResponse.response.json())
assert isinstance(test_result, ErrorResult)
async def test_next_page(self):
Core.github_key = MagicMock(return_value="lol")
test_class_instance = githubcode.SearchGithubCode(word="test", limit=500)
test_result = githubcode.SuccessResult(list(), next_page=2, last_page=4)
assert(2 == test_class_instance.next_page_or_end(test_result))
assert(2 == await test_class_instance.next_page_or_end(test_result))
async def test_last_page(self):
Core.github_key = MagicMock(return_value="lol")
test_class_instance = githubcode.SearchGithubCode(word="test", limit=500)
test_result = githubcode.SuccessResult(list(), None, None)
assert(None is test_class_instance.next_page_or_end(test_result))
assert(None is await test_class_instance.next_page_or_end(test_result))
if __name__ == '__main__':
pytest.main()