Commit 865764a9 authored by Daniel Schreiber's avatar Daniel Schreiber

add test

parent 7473a4f5
Pipeline #28835 passed with stage
in 21 seconds
......@@ -330,6 +330,20 @@ class CsvUploadViewTest(APITestCase):
api_url="http://api.a.edu:7000/",
realm="a.edu",
)
self.local_sp = ServiceProvider.objects.create(
name="TestService",
expiry_date=timezone.now(),
realm="a.edu"
)
self.sp_user = TokenAuthUser.objects.create_superuser(
username='sp',
email='foo@bar.com',
password='sp',
user_type=UserType.TYPE_SP,
api_url="http://api.a.edu:7000/",
realm="a.edu",
sp=self.local_sp,
)
self.url = reverse('csv_upload')
......@@ -341,6 +355,15 @@ class CsvUploadViewTest(APITestCase):
r = self.upload_csv(data)
self.assertEqual(r.status_code, 401)
def test_unauthorized(self):
now = timezone.now()
data = (
(self.user1, '31.12.%s' % now.year),
)
self.client.force_authenticate(self.sp_user)
r = self.upload_csv(data)
self.assertEqual(r.status_code, 403)
def test_modify(self):
now = timezone.now()
data = (
......
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