Пример #1
0
 def test_exception_unicode_includes_user_friendly_message(self):
     # When the error is an authentication error, the message is more
     # user-friendly than the default 'Invalid consumer.'.
     original_exception = oauth.OAuthError('Invalid consumer.')
     maas_exception = OAuthUnauthorized(original_exception)
     self.assertThat(str(maas_exception),
                     Contains("Authorization Error: Invalid API key."))
Пример #2
0
 def test_exception_unicode_includes_original_failure_message(self):
     error_msg = factory.make_name('error-message')
     original_exception = oauth.OAuthError(error_msg)
     maas_exception = OAuthUnauthorized(original_exception)
     self.assertThat(
         str(maas_exception),
         Contains("Authorization Error: %r" % error_msg))