Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
roomlist
Commits
44ce62e2
Commit
44ce62e2
authored
Feb 01, 2016
by
Daniel W Bond
Browse files
added additional checks for housing __contains__
parent
7abf3797
Changes
1
Hide whitespace changes
Inline
Side-by-side
roomlist/housing/test_models.py
View file @
44ce62e2
...
@@ -23,6 +23,18 @@ class BuildingTest(TestCase):
...
@@ -23,6 +23,18 @@ class BuildingTest(TestCase):
wilson_third
.
save
()
wilson_third
.
save
()
wilson_313
.
save
()
wilson_313
.
save
()
harrison
=
Building
.
objects
.
create
(
name
=
'Harrison'
,
neighbourhood
=
'sh'
,
campus
=
'ff'
)
harrison_third
=
Floor
.
objects
.
create
(
building
=
harrison
,
number
=
3
)
harrison_313
=
Room
.
objects
.
create
(
floor
=
harrison_third
,
number
=
313
)
global
harrison
global
harrison_third
global
harrison_313
harrison
.
save
()
harrison_third
.
save
()
harrison_313
.
save
()
gmason
=
User
.
objects
.
create_user
(
username
=
'gmason'
,
gmason
=
User
.
objects
.
create_user
(
username
=
'gmason'
,
first_name
=
'George'
,
first_name
=
'George'
,
last_name
=
'Mason'
,
last_name
=
'Mason'
,
...
@@ -37,24 +49,30 @@ class BuildingTest(TestCase):
...
@@ -37,24 +49,30 @@ class BuildingTest(TestCase):
def
test_building_contains_room
(
self
):
def
test_building_contains_room
(
self
):
self
.
assertTrue
(
wilson_313
in
wilson
)
self
.
assertTrue
(
wilson_313
in
wilson
)
self
.
assertFalse
(
harrison_313
in
wilson
)
def
test_building_contains_floor
(
self
):
def
test_building_contains_floor
(
self
):
self
.
assertTrue
(
wilson_third
in
wilson
)
self
.
assertTrue
(
wilson_third
in
wilson
)
self
.
assertFalse
(
harrison_third
in
wilson
)
def
test_building_contains_student
(
self
):
def
test_building_contains_student
(
self
):
self
.
assertTrue
(
george
in
wilson
)
self
.
assertTrue
(
george
in
wilson
)
self
.
assertFalse
(
george
in
harrison
)
class
FloorTest
(
TestCase
):
class
FloorTest
(
TestCase
):
def
test_floor_contains_room
(
self
):
def
test_floor_contains_room
(
self
):
self
.
assertTrue
(
wilson_313
in
wilson_third
)
self
.
assertTrue
(
wilson_313
in
wilson_third
)
self
.
assertFalse
(
harrison_313
in
wilson_third
)
def
test_floor_contains_student
(
self
):
def
test_floor_contains_student
(
self
):
self
.
assertTrue
(
george
in
wilson_third
)
self
.
assertTrue
(
george
in
wilson_third
)
self
.
assertFalse
(
george
in
harrison_third
)
class
RoomTest
(
TestCase
):
class
RoomTest
(
TestCase
):
def
test_room_contains_student
(
self
):
def
test_room_contains_student
(
self
):
self
.
assertTrue
(
george
in
wilson_313
)
self
.
assertTrue
(
george
in
wilson_313
)
self
.
assertFalse
(
george
in
harrison_313
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment