Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexander Karev
committed
Feb 24, 2014
1 parent
050932c
commit 79908ff
Showing
2 changed files
with
59 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# coding: utf-8 | ||
|
||
from pytest_django.db_reuse import _get_db_name | ||
|
||
|
||
def test_testname(): | ||
db_settings = { | ||
'ENGINE': 'django.db.backends.postgresql_psycopg2', | ||
'NAME': 'pytest_django', | ||
'TEST_NAME': 'test123', | ||
'HOST': 'localhost', | ||
'USER': '', | ||
} | ||
assert _get_db_name(db_settings, None) == 'test123' | ||
|
||
|
||
def test_name(): | ||
db_settings = { | ||
'ENGINE': 'django.db.backends.postgresql_psycopg2', | ||
'NAME': 'pytest_django', | ||
'TEST_NAME': '', | ||
'HOST': 'localhost', | ||
'USER': '', | ||
} | ||
assert _get_db_name(db_settings, None) == 'test_pytest_django' | ||
|
||
|
||
def test_testname_with_suffix(): | ||
db_settings = { | ||
'ENGINE': 'django.db.backends.postgresql_psycopg2', | ||
'NAME': 'pytest_django', | ||
'TEST_NAME': 'test123', | ||
'HOST': 'localhost', | ||
'USER': '', | ||
} | ||
assert _get_db_name(db_settings, 'abc') == 'test123_abc' | ||
|
||
|
||
def test_name_with_suffix(): | ||
db_settings = { | ||
'ENGINE': 'django.db.backends.postgresql_psycopg2', | ||
'NAME': 'pytest_django', | ||
'TEST_NAME': '', | ||
'HOST': 'localhost', | ||
'USER': '', | ||
} | ||
assert _get_db_name(db_settings, 'abc') == 'test_pytest_django_abc' |