Esempio n. 1
0
    def test_authentication_fail(self):
        with self.assertRaises(AuthenticationError):
            connection = ConnectionMock(self.wrong_password_credentials)
            connection.address = self.address
            AuthenticationHandler.authenticate_connection(connection.request, connection.address)

        with self.assertRaises(AuthenticationError):
            connection = ConnectionMock(self.wrong_username_credentials)
            connection.address = self.address
            AuthenticationHandler.authenticate_connection(connection.request, connection.address)
Esempio n. 2
0
    def test_authentication_fail(self):
        with self.assertRaises(AuthenticationError):
            connection = ConnectionMock(self.wrong_password_credentials)
            connection.address = self.address
            AuthenticationHandler.authenticate_connection(
                connection.request, connection.address)

        with self.assertRaises(AuthenticationError):
            connection = ConnectionMock(self.wrong_username_credentials)
            connection.address = self.address
            AuthenticationHandler.authenticate_connection(
                connection.request, connection.address)
Esempio n. 3
0
 def test_authentication_success(self):
     connection = ConnectionMock(self.correct_credentials)
     connection.address = self.address
     AuthenticationHandler.authenticate_connection(connection.request, connection.address)
     self.assertEqual(connection.request.to_send, b'ACK')
Esempio n. 4
0
 def test_authentication_success(self):
     connection = ConnectionMock(self.correct_credentials)
     connection.address = self.address
     AuthenticationHandler.authenticate_connection(connection.request,
                                                   connection.address)
     self.assertEqual(connection.request.to_send, b'ACK')