Fix tests
This commit is contained in:
@@ -5,7 +5,7 @@ from webapp.utils import month_from_now
|
||||
|
||||
def createEventObject(
|
||||
name="Testitapahtuma1",
|
||||
visible=True,
|
||||
isPublished=True,
|
||||
start_time=timezone.now(),
|
||||
end_time=month_from_now(),
|
||||
tag_id=[],
|
||||
@@ -14,7 +14,7 @@ def createEventObject(
|
||||
return Event.objects.create(
|
||||
title_fi=name,
|
||||
title_en=f"title_en {name}",
|
||||
visible=visible,
|
||||
isPublished=isPublished,
|
||||
description_fi=f"desc_fi {name}",
|
||||
description_en=f"desc_en {name}",
|
||||
content_fi=f"content_fi {name}",
|
||||
@@ -27,15 +27,15 @@ def createEventObject(
|
||||
|
||||
def createEventJSON(
|
||||
name="POST1",
|
||||
visible=True,
|
||||
isPublished=True,
|
||||
start_time=timezone.now(),
|
||||
end_time=month_from_now(),
|
||||
tag_id=[],
|
||||
tagId=[],
|
||||
signup_id=[],
|
||||
):
|
||||
return {
|
||||
"tag_id": tag_id,
|
||||
"visible": visible,
|
||||
"tagId": tagId,
|
||||
"visible": isPublished,
|
||||
"title_fi": f"title_fi {name}",
|
||||
"title_en": f"title_en {name}",
|
||||
"description_fi": f"desc_fi {name}",
|
||||
|
||||
@@ -21,20 +21,20 @@ class EventTestCase(APITestCase):
|
||||
# Invisible but relevant
|
||||
createEventObject(
|
||||
"Testitapahtuma2",
|
||||
visible=False,
|
||||
isPublished=False,
|
||||
start_time=timezone.datetime(2018, 11, 9, 12, 0, 0),
|
||||
)
|
||||
# Visible but unrelevant
|
||||
test2 = createEventObject(
|
||||
"Testitapahtuma3",
|
||||
visible=True,
|
||||
isPublished=True,
|
||||
start_time=timezone.datetime(2018, 12, 9, 12, 0, 0),
|
||||
end_time=timezone.datetime(2018, 12, 9, 13, 0, 0),
|
||||
)
|
||||
# Visible and relevant
|
||||
createEventObject(
|
||||
"Testitapahtuma4",
|
||||
visible=True,
|
||||
isPublished=True,
|
||||
start_time=timezone.datetime(2018, 12, 9, 12, 0, 0),
|
||||
)
|
||||
# Add some tags
|
||||
@@ -122,7 +122,7 @@ class EventTestCase(APITestCase):
|
||||
self.client.force_authenticate(user=self.authClient)
|
||||
response = self.client.post(
|
||||
URL,
|
||||
createEventJSON(tag_id=[self.testTagId], signup_id=[self.signupFormId]),
|
||||
createEventJSON(tagId=[self.testTagId], signup_id=[self.signupFormId]),
|
||||
format="json",
|
||||
)
|
||||
|
||||
@@ -132,7 +132,7 @@ class EventTestCase(APITestCase):
|
||||
def test_post_event_unauth(self):
|
||||
response = self.client.post(
|
||||
URL,
|
||||
createEventJSON(tag_id=[self.testTagId], signup_id=[self.signupFormId]),
|
||||
createEventJSON(tagId=[self.testTagId], signup_id=[self.signupFormId]),
|
||||
format="json",
|
||||
)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class FeedTestCase(APITestCase):
|
||||
|
||||
feed = Feed.objects.create(
|
||||
title="TestFeed",
|
||||
visible=True,
|
||||
isPublished=True,
|
||||
description="diidadaapa",
|
||||
content="lorem ipsum",
|
||||
)
|
||||
@@ -51,10 +51,10 @@ class FeedTestCase(APITestCase):
|
||||
tag2_id = tagBuilder("test2").id
|
||||
|
||||
data = {
|
||||
"tag_id": [tag1_id, tag2_id],
|
||||
"tagId": [tag1_id, tag2_id],
|
||||
"title_fi": "testtitle",
|
||||
"title_en": "testtitle",
|
||||
"visible": "True",
|
||||
"isPublished": "True",
|
||||
"description_fi": "liirumlaarum",
|
||||
"description_en": "liirumlaarum",
|
||||
"content_fi": "lorem ipsum",
|
||||
|
||||
@@ -13,7 +13,7 @@ class JobAdTestCase(APITestCase):
|
||||
self.prefilled_jobad = JobAd.objects.create(
|
||||
title_fi="ABB Test",
|
||||
title_en="ABB Test",
|
||||
visible=True,
|
||||
isPublished=True,
|
||||
description_fi="desc",
|
||||
description_en="desc",
|
||||
content_fi="lorem",
|
||||
@@ -35,12 +35,12 @@ class JobAdTestCase(APITestCase):
|
||||
data = {
|
||||
"title_fi": "testtitle",
|
||||
"title_en": "testtitle",
|
||||
"visible": "True",
|
||||
"isPublished": "True",
|
||||
"description_fi": "liirumlaarum",
|
||||
"description_en": "liirumlaarum",
|
||||
"content_fi": "lorem ipsum",
|
||||
"content_en": "lorem ipsum",
|
||||
"autohide_enabled": "True",
|
||||
"autoUnpublish": "True",
|
||||
}
|
||||
|
||||
# Try post without authentication
|
||||
|
||||
Reference in New Issue
Block a user