Example #1
0
    def test_user_pw(self):
        test = "mysql://*****:*****@"
        matches = REGEX_RFC1738.match(test)

        self.assertTrue(matches)
        self.assertEqual(matches.group('protocol'), 'mysql')
        self.assertEqual(matches.group('username'), 'user')
        self.assertEqual(matches.group('password'), 'password')
        self.assertEqual(matches.group('host'), '')
        self.assertEqual(matches.group('port'), None)
Example #2
0
    def test_db(self):
        test = "mysql:///database"
        matches = REGEX_RFC1738.match(test)

        self.assertTrue(matches)
        self.assertEqual(matches.group('protocol'), 'mysql')
        self.assertEqual(matches.group('username'), None)
        self.assertEqual(matches.group('password'), None)
        self.assertEqual(matches.group('host'), '')
        self.assertEqual(matches.group('port'), None)
Example #3
0
    def test_db(self):
        test = "mysql:///database"
        matches = REGEX_RFC1738.match(test)

        self.assertTrue(matches)
        self.assertEqual(matches.group('protocol'), 'mysql')
        self.assertEqual(matches.group('username'), None)
        self.assertEqual(matches.group('password'), None)
        self.assertEqual(matches.group('host'), '')
        self.assertEqual(matches.group('port'), None)
Example #4
0
    def test_user_pw(self):
        test = "mysql://*****:*****@"
        matches = REGEX_RFC1738.match(test)

        self.assertTrue(matches)
        self.assertEqual(matches.group('protocol'), 'mysql')
        self.assertEqual(matches.group('username'), 'user')
        self.assertEqual(matches.group('password'), 'password')
        self.assertEqual(matches.group('host'), '')
        self.assertEqual(matches.group('port'), None)
Example #5
0
    def test_host_port(self):
        test = "mysql://localhost:3306"
        matches = REGEX_RFC1738.match(test)

        self.assertTrue(matches)
        self.assertEqual(matches.group('protocol'), 'mysql')
        self.assertEqual(matches.group('username'), None)
        self.assertEqual(matches.group('password'), None)
        self.assertEqual(matches.group('host'), 'localhost')
        self.assertEqual(matches.group('port'), '3306')
        self.assertEqual(matches.group('database'), None)
Example #6
0
    def test_user_pw_host_db(self):
        test = "mysql://*****:*****@localhost/database"
        matches = REGEX_RFC1738.match(test)

        self.assertTrue(matches)
        self.assertEqual(matches.group('protocol'), 'mysql')
        self.assertEqual(matches.group('username'), 'user')
        self.assertEqual(matches.group('password'), 'password')
        self.assertEqual(matches.group('host'), 'localhost')
        self.assertEqual(matches.group('port'), None)
        self.assertEqual(matches.group('database'), 'database')
Example #7
0
    def test_host_port(self):
        test = "mysql://localhost:3306"
        matches = REGEX_RFC1738.match(test)

        self.assertTrue(matches)
        self.assertEqual(matches.group('protocol'), 'mysql')
        self.assertEqual(matches.group('username'), None)
        self.assertEqual(matches.group('password'), None)
        self.assertEqual(matches.group('host'), 'localhost')
        self.assertEqual(matches.group('port'), '3306')
        self.assertEqual(matches.group('database'), None)
Example #8
0
    def test_user_pw_host_db(self):
        test = "mysql://*****:*****@localhost/database"
        matches = REGEX_RFC1738.match(test)

        self.assertTrue(matches)
        self.assertEqual(matches.group('protocol'), 'mysql')
        self.assertEqual(matches.group('username'), 'user')
        self.assertEqual(matches.group('password'), 'password')
        self.assertEqual(matches.group('host'), 'localhost')
        self.assertEqual(matches.group('port'), None)
        self.assertEqual(matches.group('database'), 'database')