Esempio n. 1
0
    def test_query_collections(self):
        api = PhishNetAPI()
        collections_response = api.query_collections(uid=1)

        assert collections_response['error_code'] == 0
        assert collections_response['response']['count'] == len(
            collections_response['response']['data'])
Esempio n. 2
0
    def test_query_collections(self, requests_mock):
        api = PhishNetAPI('apikey123456789test1')
        with open('tests/data/query_collection.json') as f:
            query_collection_json = json.load(f)
        requests_mock.post(api.base_url + "collections/query",
                           json=query_collection_json)

        collections_response = api.query_collections(uid=1)
        assert collections_response['response']['count'] == 7
        assert len(collections_response['response']['data']) == 7
        assert collections_response['response']['data'][0]['count'] == 2