Adds some unit tests

This commit is contained in:
Aaron Louie 2019-11-14 13:36:08 -05:00
parent c0035f4d94
commit 02bd2c847f
2 changed files with 32 additions and 2 deletions

View File

@ -1,3 +1,33 @@
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")

View File

@ -22,5 +22,5 @@ from material.frontend import urls as frontend_urls
urlpatterns = [
url(r'^$', generic.RedirectView.as_view(url='/workflow/', permanent=False)),
url(r'', include(frontend_urls)),
# path('admin/', admin.site.urls),
path('admin/', admin.site.urls),
]