Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aviupadhyayula committed Nov 23, 2024
1 parent 381ad09 commit 40a72a8
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions backend/tests/clubs/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,33 @@ def test_event_create_update_delete(self):
)
self.assertIn(resp.status_code, [200, 204], resp.content)

def test_event_create_unapproved_club(self):
self.club1.approved = False
self.club1.save()

start_date = datetime.datetime.now() - datetime.timedelta(days=3)
end_date = start_date + datetime.timedelta(hours=2)

# add user as officer
Membership.objects.create(
person=self.user1, club=self.club1, role=Membership.ROLE_OFFICER
)

self.client.login(username=self.user1.username, password="test")
resp = self.client.post(
reverse("club-events-list", args=(self.club1.code,)),
{
"name": "Interest Meeting",
"description": "Interest Meeting on Friday!",
"location": "JMHH G06",
"type": Event.RECRUITMENT,
"start_time": start_date.isoformat(),
"end_time": end_date.isoformat(),
},
content_type="application/json",
)
self.assertEqual(resp.status_code, 403, resp.content)

def test_recurring_event_create(self):
self.client.login(username=self.user4.username, password="test")
self.assertFalse(self.user4.is_superuser)
Expand Down

0 comments on commit 40a72a8

Please sign in to comment.