def test_auth_challenge_no_challenge(self): """ Tests auth_challenge when the challenge received is None """ client = RSAClient(self.priv_key) remote = RemoteProxy() challenge = None client.auth_challenge(challenge, remote, self.pub_key) #verify that auth_response got called self.assertEqual(remote.func, 'auth_response', 'Calling auth_challenge should trigger auth_response call on server') #verify the correct response was sent self.assertFalse(remote.kwargs['response'], 'Response did not match the expected response')
def test_auth_challenge_no_server_key(self): """ Tests auth_challenge when server key is None. """ client = RSAClient(self.priv_key) avatar = RSAAvatar(self.priv_key, None, self.pub_key, key_size=KEY_SIZE) remote = RemoteProxy() challenge = avatar.perspective_auth_challenge() client.auth_challenge(challenge, remote, None) #verify that auth_response got called self.assertEqual(remote.func, 'auth_response', 'Calling auth_challenge should trigger auth_response call on server') #verify the correct response was sent self.assertFalse(remote.kwargs['response'], 'Response did not match the expected response')
def test_auth_challenge(self): """ Tests a normal challenge string Verifies: * remote call is sent * response equals challenge """ client = RSAClient(self.priv_key) avatar = RSAAvatar(self.priv_key, None, self.pub_key, key_size=KEY_SIZE) remote = RemoteProxy() challenge = avatar.perspective_auth_challenge() client.auth_challenge(challenge, remote, self.pub_key) #verify that auth_response got called args, kwargs, deferred = remote.assertCalled(self, 'auth_response') self.assertEqual(kwargs['response'], avatar.challenge, 'Response did not match the expected response')
def test_auth_challenge_no_challenge(self): """ Tests auth_challenge when the challenge received is None Verifies: * remote call is sent * auth is denied """ client = RSAClient(self.priv_key) remote = RemoteProxy() challenge = None client.auth_challenge(challenge, remote, self.pub_key) #verify that auth_response got called args, kwargs, deferred = remote.assertCalled(self, 'auth_response') #verify the correct response was sent self.assertFalse(kwargs['response'], 'Response did not match the expected response')
def test_auth_challenge_no_server_key(self): """ Tests auth_challenge when server key is None. Verifies: * remote call is sent * auth is denied """ client = RSAClient(self.priv_key) avatar = RSAAvatar(self.priv_key, None, self.pub_key, key_size=KEY_SIZE) remote = RemoteProxy() challenge = avatar.perspective_auth_challenge() client.auth_challenge(challenge, remote, None) #verify that auth_response got called args, kwargs, deferred = remote.assertCalled(self, 'auth_response') #verify the correct response was sent self.assertFalse(kwargs['response'], 'Response did not match the expected response')