Adds some unit tests
This commit is contained in:
parent
c0035f4d94
commit
02bd2c847f
32
app/tests.py
32
app/tests.py
|
@ -1,3 +1,33 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
from app.models import CRConnectProcess
|
||||||
|
from app.flows import CRConnectFlow
|
||||||
|
|
||||||
# Create your tests here.
|
|
||||||
|
class CRConnectProcessTestCase(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
CRConnectProcess.objects.create(text="Process 1", approved=False)
|
||||||
|
CRConnectProcess.objects.create(text="Process 2", approved=True)
|
||||||
|
|
||||||
|
def test_processes_are_created(self):
|
||||||
|
"""Processes are created and their attributes are initialized properly"""
|
||||||
|
p1 = CRConnectProcess.objects.get(text="Process 1")
|
||||||
|
p2 = CRConnectProcess.objects.get(text="Process 2")
|
||||||
|
self.assertEqual(p1.approved, False)
|
||||||
|
self.assertEqual(p2.approved, True)
|
||||||
|
|
||||||
|
def test_processes_are_modified(self):
|
||||||
|
"""Process attributes can be modified"""
|
||||||
|
CRConnectProcess.objects.update_or_create(
|
||||||
|
text="Process 1",
|
||||||
|
defaults={"text": "Process Renamed 1", "approved": True}
|
||||||
|
)
|
||||||
|
|
||||||
|
CRConnectProcess.objects.update_or_create(
|
||||||
|
text="Process 2",
|
||||||
|
defaults={"text": "Process Renamed 2", "approved": False}
|
||||||
|
)
|
||||||
|
|
||||||
|
p1 = CRConnectProcess.objects.get(approved=True)
|
||||||
|
p2 = CRConnectProcess.objects.get(approved=False)
|
||||||
|
self.assertEqual(p1.text, "Process Renamed 1")
|
||||||
|
self.assertEqual(p2.text, "Process Renamed 2")
|
||||||
|
|
|
@ -22,5 +22,5 @@ from material.frontend import urls as frontend_urls
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^$', generic.RedirectView.as_view(url='/workflow/', permanent=False)),
|
url(r'^$', generic.RedirectView.as_view(url='/workflow/', permanent=False)),
|
||||||
url(r'', include(frontend_urls)),
|
url(r'', include(frontend_urls)),
|
||||||
# path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue