Beispiel #1
0
def test_can_create_default_retry_handler():
    mock_client = mock.Mock()
    mock_client.meta.service_model.service_id = model.ServiceId('my-service')
    assert_is_instance(standard.register_retry_handler(mock_client),
                       standard.RetryHandler)
    call_args_list = mock_client.meta.events.register.call_args_list
    # We should have registered the retry quota to after-calls
    first_call = call_args_list[0][0]
    second_call = call_args_list[1][0]
    # Not sure if there's a way to verify the class associated with the
    # bound method matches what we expect.
    assert_equal(first_call[0], 'after-call.my-service')
    assert_equal(second_call[0], 'needs-retry.my-service')
Beispiel #2
0
 def test_hyphenize_lower_cases(self):
     self.assertEqual(model.ServiceId('MyService').hyphenize(), 'myservice')
Beispiel #3
0
 def test_hypenize_replaces_spaces(self):
     self.assertEqual(
         model.ServiceId('my service').hyphenize(), 'my-service')