mirror of
https://github.com/laramies/theHarvester.git
synced 2026-09-26 19:44:53 +02:00
Adding tests
This commit is contained in:
@@ -39,6 +39,31 @@ class TestSearchGithubCode:
|
||||
test_result = test_class_instance.fragments_from_response(response)
|
||||
assert test_result == ["test1", "test2"]
|
||||
|
||||
def test_fail_fragments_from_response(self):
|
||||
Core.github_key = MagicMock(return_value="lol")
|
||||
test_class_instance = githubcode.SearchGithubCode(word="test", limit=500)
|
||||
response = Response()
|
||||
json = {
|
||||
"items": [
|
||||
{
|
||||
"fail": True
|
||||
},
|
||||
{
|
||||
"text_matches": []
|
||||
},
|
||||
{
|
||||
"text_matches": [
|
||||
{
|
||||
"weird": "result"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
response.json = MagicMock(return_value=json)
|
||||
test_result = test_class_instance.fragments_from_response(response)
|
||||
assert test_result == []
|
||||
|
||||
if __name__ == '__main__':
|
||||
pytest.main()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user