Commit caacb301 authored by Lukas Burgey's avatar Lukas Burgey
Browse files

Add some view tests

parent 46dbdcf4
from .. import test_models
from django.contrib import auth
from django.test import Client
from django.test import TestCase
class ViewTest(TestCase):
def setUp(self):
test_models.setup_fixture()
def tearDown(self):
test_models.teardown_fixture()
def test_view(self):
client = Client()
user = auth.authenticate(
username=test_models.TEST_NAME,
password=test_models.TEST_PASSWORD,
)
client.force_login(
user=user
)
response = client.get(
'/backend/api/state/',
)
self.assertTrue(response.json()['logged_in'])
self.assertEqual(response.json()['user']['userinfo']['email'], test_models.TEST_EMAIL)
from django.contrib import auth from django.contrib import auth
from django.test import TestCase from django.test import TestCase
#from django.test import Client
from django_backend.backend import models from django_backend.backend import models
from django_backend.backend.auth.v1 import models as auth_models from django_backend.backend.auth.v1 import models as auth_models
...@@ -33,7 +32,7 @@ def setup_fixture(): ...@@ -33,7 +32,7 @@ def setup_fixture():
sub=TEST_NAME, sub=TEST_NAME,
user_type='oidcuser', user_type='oidcuser',
userinfo={ userinfo={
'email': TEST_NAME, 'email': TEST_EMAIL,
'sub': TEST_NAME, 'sub': TEST_NAME,
}, },
idp=idp, idp=idp,
...@@ -133,9 +132,3 @@ class DeploymentTest(TestCase): ...@@ -133,9 +132,3 @@ class DeploymentTest(TestCase):
withdrawal_task.item_finished(site) withdrawal_task.item_finished(site)
self.assertFalse(deployment.deploys.exists()) self.assertFalse(deployment.deploys.exists())
self.assertFalse(deployment.withdrawals.exists()) self.assertFalse(deployment.withdrawals.exists())
#class ViewTest(TestCase):
# def test_view(self):
# client = Client()
# client.get('/backend/api/state')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment