Пример #1
0
    def test_get_show_attendees(self):
        api = PhishNetAPI()
        attendees_response = api.get_show_attendees(showdate='1991-07-19')

        assert attendees_response['error_code'] == 0
        assert attendees_response['response']['count'] == len(
            attendees_response['response']['data'])
        with pytest.raises(ParamValidationError):
            api.get_show_attendees(showdate='1991-13-19')
            api.get_show_attendees(showdate='1982-12-19')
            api.get_show_attendees(showid=0)
Пример #2
0
    def test_get_show_attendees(self, requests_mock):
        api = PhishNetAPI('apikey123456789test1')
        with open('tests/data/show_attendees.json') as f:
            show_attendees_json = json.load(f)
        requests_mock.post(api.base_url + "attendance/get",
                           json=show_attendees_json)

        attendees_response = api.get_show_attendees(showdate='1991-07-19')
        assert attendees_response['response']['count'] == 53
        assert len(attendees_response['response']['data']) == 53
        with pytest.raises(ParamValidationError):
            api.get_show_attendees(showdate='1991-13-19')
            api.get_show_attendees(showdate='1982-12-19')
            api.get_show_attendees(showid=0)