Пример #1
0
    def test_validated(self, mock_get):
        message = 'hello'
        consumer_id = 'test-consumer_id'
        document = Mock()
        document.any = {'consumer_id': consumer_id}
        key = RSA.load_key_bio(BIO.MemoryBuffer(RSA_KEY))

        mock_get.return_value = RSA.load_pub_key_bio(BIO.MemoryBuffer(RSA_PUB))

        authenticator = Authenticator()
        authenticator.validate(document, message, key.sign(message))

        mock_get.assert_called_with(consumer_id)
Пример #2
0
    def test_validated(self, mock_get):
        message = 'hello'
        consumer_id = 'test-consumer_id'
        document = Mock()
        document.any = {'consumer_id': consumer_id}
        key = RSA.load_key_bio(BIO.MemoryBuffer(RSA_KEY))

        mock_get.return_value = RSA.load_pub_key_bio(BIO.MemoryBuffer(RSA_PUB))

        authenticator = Authenticator()
        authenticator.validate(document, message, key.sign(message))

        mock_get.assert_called_with(consumer_id)
Пример #3
0
 def test_validate_not_enabled(self):
     authenticator = Authenticator()
     authenticator.enabled = False
     authenticator.validate('', '', '')
Пример #4
0
 def test_validate_not_enabled(self):
     authenticator = Authenticator()
     authenticator.enabled = False
     authenticator.validate('', '', '')