From ffeee00b68ee6c698c2f3b49260f76355e3f4cfd Mon Sep 17 00:00:00 2001 From: Andrei-Adnan Ismail Date: Mon, 19 Oct 2015 15:21:38 +0300 Subject: [PATCH] #410 Running authentication tests against all the available scenarios --- test/authentication_test.py | 44 +++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/test/authentication_test.py b/test/authentication_test.py index 2c387e8b6..856a103ed 100644 --- a/test/authentication_test.py +++ b/test/authentication_test.py @@ -6,34 +6,46 @@ from proxysql_base_test import ProxySQLBaseTest class AuthenticationTest(ProxySQLBaseTest): + def _test_existing_user_with_correct_password_works(self): + version1 = self.run_query_mysql( "SELECT @@version_comment LIMIT 1", "test", return_result=True, username="john", password="doe") - version2 = ProxySQLBaseTest.run_query_proxysql( + version2 = self.run_query_proxysql( "SELECT @@version_comment LIMIT 1", "test", return_result=True, username="john", password="doe") self.assertEqual(version1, version2) - @raises(OperationalError) + def test_existing_user_with_correct_password_works(self): + self.run_in_docker_scenarios(self._test_existing_user_with_correct_password_works) + + def _test_existing_user_with_correct_password_but_not_registerd_within_proxysql_does_not_work(self): + self.assert_raises(self.run_query_proxysql, OperationalError, + "SELECT @@version_comment LIMIT 1", "test", + return_result=True, username="danny", password="white") + def test_existing_user_with_correct_password_but_not_registerd_within_proxysql_does_not_work(self): - version1 = ProxySQLBaseTest.run_query_proxysql( - "SELECT @@version_comment LIMIT 1", "test", - return_result=True, - username="danny", password="white") + self.run_in_docker_scenarios(self._test_existing_user_with_correct_password_works) + +""" + def _test_existing_user_with_incorrect_password_does_not_work(self): + self.assert_raises(self.run_query_proxysql, OperationalError, + "SELECT @@version_comment LIMIT 1", "test", + return_result=True, + username="john", password="doe2") - @raises(OperationalError) def test_existing_user_with_incorrect_password_does_not_work(self): - version = ProxySQLBaseTest.run_query_proxysql( - "SELECT @@version_comment LIMIT 1", "test", - return_result=True, - username="john", password="doe2") + self.run_in_docker_scenarios(self._test_existing_user_with_incorrect_password_does_not_work) + + def _test_inexisting_user_with_random_password_does_not_work(self): + self.assert_raises(self.run_query_proxysql, OperationalError, + "SELECT @@version_comment LIMIT 1", "test", + return_result=True, + username="johnny", password="randomdoe") - @raises(OperationalError) def test_inexisting_user_with_random_password_does_not_work(self): - version = ProxySQLBaseTest.run_query_proxysql( - "SELECT @@version_comment LIMIT 1", "test", - return_result=True, - username="johnny", password="randomdoe") \ No newline at end of file + self.run_in_docker_scenarios(self._test_inexisting_user_with_random_password_does_not_work) +""" \ No newline at end of file