def test_parse_sqlite_in_memory(self): url = 'sqlite://:memory:' parsed = database.parse(url) self.assertDictEqual(parsed, { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', }) url = 'sqlite://' parsed = database.parse(url) self.assertDictEqual(parsed, { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', })
def test_parse_sqlite(self): url = 'sqlite:///directory/file.db' parsed = database.parse(url) self.assertDictEqual(parsed, { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'directory/file.db', 'USER': '', 'PASSWORD': '', 'HOST': None, 'PORT': '', })
def test_engine(self): url = 'scheme://*****:*****@host:123/name' parsed = database.parse(url, engine='X') self.assertDictEqual(parsed, { 'ENGINE': 'X', 'NAME': 'name', 'USER': '******', 'PASSWORD': '******', 'HOST': 'host', 'PORT': 123 })
def test_parse_mysql_openshift(self): url = 'mysql://*****:*****@127.11.207.130:3306/' parsed = database.parse(url) self.assertDictEqual(parsed, { 'ENGINE': 'django.db.backends.mysql', 'NAME': '', 'USER': '******', 'PASSWORD': '******', 'HOST': '127.11.207.130', 'PORT': 3306 })
def test_parse_sqlite(self): url = 'sqlite:///directory/file.db' parsed = database.parse(url) self.assertDictEqual( parsed, { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'directory/file.db', 'USER': '', 'PASSWORD': '', 'HOST': None, 'PORT': '', })
def test_engine(self): url = 'scheme://*****:*****@host:123/name' parsed = database.parse(url, engine='X') self.assertDictEqual( parsed, { 'ENGINE': 'X', 'NAME': 'name', 'USER': '******', 'PASSWORD': '******', 'HOST': 'host', 'PORT': 123 })
def test_parse_mysql_openshift(self): url = 'mysql://*****:*****@127.11.207.130:3306/' parsed = database.parse(url) self.assertDictEqual( parsed, { 'ENGINE': 'django.db.backends.mysql', 'NAME': '', 'USER': '******', 'PASSWORD': '******', 'HOST': '127.11.207.130', 'PORT': 3306 })
def test_parse_mysql_heroku(self): url = 'mysql://*****:*****@us-cdbr-east-05.cleardb.net/heroku_ec5fddc308fbe9e?reconnect=true' parsed = database.parse(url) parsed_expect = { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'heroku_ec5fddc308fbe9e', 'USER': '******', 'PASSWORD': '******', 'HOST': 'us-cdbr-east-05.cleardb.net', 'PORT': '' } self.assertDictEqual(parsed, parsed_expect)
def test_parse_postgres_dotcloud(self): url = 'pgsql://*****:*****@abcd1234.dotcloud.com:1337' parsed = database.parse(url) parsed_expect = { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': '', 'USER': '******', 'PASSWORD': '******', 'HOST': 'abcd1234.dotcloud.com', 'PORT': 1337 } self.assertDictEqual(parsed, parsed_expect)
def test_parse_postgres_openshift(self): url = 'postgresql://*****:*****@127.11.207.130:5432' parsed = database.parse(url) parsed_expect = { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': '', 'USER': '******', 'PASSWORD': '******', 'HOST': '127.11.207.130', 'PORT': 5432 } self.assertDictEqual(parsed, parsed_expect)
def test_parse_postgres_heroku(self): url = 'postgres://*****:*****@' + \ 'ec2-107-20-214-225.compute-1.amazonaws.com:5432/dcj1n178peejs9' parsed = database.parse(url) parsed_expect = { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'dcj1n178peejs9', 'USER': '******', 'PASSWORD': '******', 'HOST': 'ec2-107-20-214-225.compute-1.amazonaws.com', 'PORT': 5432 } self.assertDictEqual(parsed, parsed_expect)