def test_parse_local_db_string(self): dbconf = parse("mysql://*****:*****@localhost:3306/dbname") expected = { 'NAME': 'dbname', 'USER': '******', 'PASSWORD': '******', 'HOST': 'localhost', 'PORT': 3306, 'ENGINE': 'django.db.backends.mysql', } self.assertEqual(dbconf, expected)
def test_parse_cloudsql_string(self): dbconf = parse("mysql://*****:*****@project:instance/dbname") expected = { 'NAME': 'dbname', 'USER': '******', 'PASSWORD': '******', 'HOST': '/cloudsql/project:instance', 'PORT': None, 'ENGINE': 'django.db.backends.mysql', } self.assertEqual(dbconf, expected)
def test_parse_cloudsql_local(self): dbconf = parse("rdbms://*****:*****@project:instance/dbname") expected = { 'NAME': 'dbname', 'USER': '******', 'PASSWORD': '******', 'HOST': None, 'INSTANCE': 'project:instance', 'PORT': None, 'ENGINE': 'google.appengine.ext.django.backends.rdbms', } self.assertEqual(dbconf, expected)
def test_parse_wrong_string(self): dbconf = parse("foo://*****:*****@foo:8080/url") self.assertFalse('ENGINE' in dbconf)