def test_too_many_requests(self): connection = MockPortalConnection() error_message = \ 'Not enough API calls for new requests (requested {!r})'.format( _STUB_URL_PATH, ) with assert_raises_substring(AssertionError, error_message): connection.send_get_request(_STUB_URL_PATH)
def test_multiple_api_calls(self): connection = MockPortalConnection( _ConstantCallable([_STUB_API_CALL_1, _STUB_API_CALL_2]), ) assert_false(connection.api_calls) connection.send_get_request(_STUB_URL_PATH) eq_([_STUB_API_CALL_1], connection.api_calls) connection.send_post_request(_STUB_URL_PATH, None) eq_([_STUB_API_CALL_1, _STUB_API_CALL_2], connection.api_calls)