Skip to content

Commit

Permalink
Added tests for room update
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Savard committed Apr 12, 2016
1 parent 24412e1 commit 9e273c8
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions app/floorMap/tests/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from django.core.urlresolvers import reverse
from django.test import TestCase

from app.floorMap.factories import RoomFactory, RoomTypeFactory
from app.founder.factories import FounderFactory
from app.mentor.factories import MentorFactory
from app.home.factories import StaffUserProfileFactory, \
Expand All @@ -23,6 +24,95 @@ def setUp(self):

self.status = CompanyStatusFactory()

self.room_type = RoomTypeFactory()
self.room = RoomFactory(type=self.room_type)

def test_room_update(self):
"""
Tests access to room update form
"""

"""
Access : Staff
"""
self.client.logout()
self.client.login(
username=self.staff.user.username,
password="Toto1234!#"
)

result = self.client.get(
reverse('floorMap:room_update', kwargs={
'pk': self.room.id
}),
follow=False
)
self.assertEqual(result.status_code, 200)

"""
Access : Founder
"""
self.client.logout()
self.client.login(
username=self.founder.user.username,
password="Toto1234!#"
)

result = self.client.get(
reverse('floorMap:room_update', kwargs={
'pk': self.room.id
}),
follow=False
)
self.assertEqual(result.status_code, 302)

"""
Access : Mentor
"""
self.client.logout()
self.client.login(
username=self.mentor.user.username,
password="Toto1234!#"
)

result = self.client.get(
reverse('floorMap:room_update', kwargs={
'pk': self.room.id
}),
follow=False
)
self.assertEqual(result.status_code, 302)

"""
Access : Executive
"""
self.client.logout()
self.client.login(
username=self.executive.user.username,
password="Toto1234!#"
)

result = self.client.get(
reverse('floorMap:room_update', kwargs={
'pk': self.room.id
}),
follow=False
)
self.assertEqual(result.status_code, 302)

"""
No Access : Not logged
"""
self.client.logout()

result = self.client.get(
reverse('floorMap:room_update', kwargs={
'pk': self.room.id
}),
follow=False
)
self.assertEqual(result.status_code, 302)

def test_floorMap(self):
"""
To test the display of the floor map.
Expand Down

0 comments on commit 9e273c8

Please sign in to comment.