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)
    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)
    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)
    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)
    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)
    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')
    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)
    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')