Пример #1
0
 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:',
     })
Пример #2
0
 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:',
     })
Пример #3
0
 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': '',
     })
Пример #4
0
 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
     })
Пример #5
0
 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
     })
Пример #6
0
 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': '',
         })
Пример #7
0
 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
         })
Пример #8
0
 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
         })
Пример #9
0
 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)
Пример #10
0
 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)
Пример #11
0
 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)
Пример #12
0
 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)
Пример #13
0
 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)
Пример #14
0
 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)
Пример #15
0
 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)
Пример #16
0
 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)