Skip to content

Commit 5e086ed

Browse files
committed
TST: Update base tests
1 parent 900ed1a commit 5e086ed

File tree

8 files changed

+26
-46
lines changed

8 files changed

+26
-46
lines changed

tests/apps.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from django.utils.translation import gettext_lazy as _
33

44

5-
class RabidArmadilloTestAppConfig(AppConfig):
6-
name = 'tests'
7-
label = 'tests'
8-
verbose_name = _('Rabid Armadillo Test App')
5+
class TestAppConfig(AppConfig):
6+
name = "tests"
7+
label = "tests"
8+
verbose_name = _("Django GCP Test App")

tests/asgi.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import os
2+
import django_gcp.routing
23
from channels.routing import ProtocolTypeRouter, URLRouter
34
from django.core.asgi import get_asgi_application
45

5-
import rabid_armadillo.routing
6-
76

87
# TESTS ONLY - this sets up an asgi application for use in async testing of the consumer.
98
# The main django application which you're writing an app for will need to set up something similar
@@ -12,5 +11,5 @@
1211
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings")
1312

1413
application = ProtocolTypeRouter(
15-
{"http": get_asgi_application(), "websocket": URLRouter(rabid_armadillo.routing.websocket_urlpatterns)}
14+
{"http": get_asgi_application(), "websocket": URLRouter(django_gcp.routing.websocket_urlpatterns)}
1615
)

tests/models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
21
from django.db.models import CharField
3-
from rabid_armadillo.models import MyAbstractModel
2+
from django_gcp.models import MyAbstractModel
43

54

65
class Armadillo(MyAbstractModel):
@@ -10,11 +9,12 @@ class Armadillo(MyAbstractModel):
109
python manage.py makemigrations tests
1110
1211
"""
12+
1313
name = CharField(max_length=32)
1414

1515
class Meta:
16-
app_label = 'tests'
16+
app_label = "tests"
1717

1818
def __str__(self):
1919
# Ensures that the abstract class __str__ method is covered in testing
20-
return super(Armadillo, self).__str__() + ' ("{}")'.format(self.name)
20+
return super(Armadillo, self).__str__() + f' ("{self.name}")'

tests/settings.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ def get_db_conf():
55
"""
66
Configures database according to the DATABASE_ENGINE environment
77
variable. Defaults to SQlite.
8-
This method is used to let Travis run against different database backends.
8+
This method is used to let tests run against different database backends.
99
"""
1010
database_engine = os.environ.get("DATABASE_ENGINE", "sqlite")
1111
if database_engine == "sqlite":
1212
return {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}
1313
elif database_engine == "postgres":
1414
return {
1515
"ENGINE": "django.db.backends.postgresql_psycopg2",
16-
"NAME": "travis_ci_test",
17-
"USER": "postgres",
18-
"PASSWORD": "",
19-
"HOST": "127.0.0.1",
20-
"PORT": "",
16+
"NAME": "postgres_db",
17+
"USER": "postgres_user",
18+
"PASSWORD": "postgres_password",
19+
"HOST": "localhost",
20+
"PORT": "5432",
2121
}
2222

2323

@@ -33,8 +33,7 @@ def get_db_conf():
3333
"django.contrib.admin",
3434
"django.contrib.messages",
3535
"django.contrib.staticfiles",
36-
"channels",
37-
"rabid_armadillo",
36+
"django_gcp",
3837
"tests",
3938
]
4039

@@ -69,6 +68,7 @@ def get_db_conf():
6968
ROOT_URLCONF = "tests.urls"
7069

7170
STATIC_URL = "static_test/"
71+
MEDIA_URL = "media_test/"
7272

7373
LANGUAGE_CODE = "en-us"
7474
TIME_ZONE = "UTC"

tests/test_my_consumer.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/test_my_model.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
from django.test import TestCase
22

3-
from rabid_armadillo.models import MyModel
3+
4+
# from rabid_armadillo.models import MyModel
45

56

67
class MyModelTestCase(TestCase):
7-
""" "Normal" synchronous django tests to ensure your models / rest API / Whatever works correctly
8-
"""
8+
""" "Normal" synchronous django tests to ensure your models / rest API / Whatever works correctly"""
99

1010
def test_something(self):
11-
""" Test that something happens
12-
"""
13-
MyModel()
11+
"""Test that something happens"""
12+
# MyModel()

tests/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66

77

88
urlpatterns = [
9-
url(r'^admin/', admin.site.urls),
9+
url(r"^admin/", admin.site.urls),
1010
]

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ isolated_build = True
66
whitelist_externals = poetry
77
setenv =
88
DJANGO_SETTINGS_MODULE=tests.settings
9-
PYTHONPATH = {toxinidir}:{toxinidir}/rabid_armadillo
9+
PYTHONPATH = {toxinidir}:{toxinidir}/django_gcp
1010
sqlite: DATABASE_ENGINE=sqlite
1111
postgres: DATABASE_ENGINE=postgres
1212
commands =
13-
coverage run --source rabid_armadillo -m pytest
13+
coverage run --source django_gcp -m pytest
1414
coverage report --show-missing
1515
coverage xml
1616
deps =

0 commit comments

Comments
 (0)