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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
    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)
    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)