Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f7f1438b
authored
Apr 16, 2013
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
school: unittests for Semester
parent
2862eb61
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletions
+23
-1
school/tests.py
+23
-1
No files found.
school/tests.py
View file @
f7f1438b
...
...
@@ -55,11 +55,12 @@ class PersonTestCase(TestCase):
class
CourseTestCase
(
TestCase
):
def
setUp
(
self
):
now
=
datetime
.
now
()
date
=
now
.
date
()
delta
=
timedelta
(
weeks
=
7
)
self
.
testperson1
=
Person
.
objects
.
create
(
code
=
"testperson1"
)
self
.
testperson2
=
Person
.
objects
.
create
(
code
=
"testperson2"
)
self
.
testsemester
=
Semester
.
objects
.
create
(
name
=
"testsemester"
,
start
=
now
-
delta
,
end
=
now
+
delta
)
start
=
date
-
delta
,
end
=
date
+
delta
)
self
.
testcourse
=
Course
.
objects
.
create
(
code
=
"testcode"
,
name
=
"testname"
,
short_name
=
"tn"
)
self
.
testcourse
.
owners
.
add
(
self
.
testperson1
,
self
.
testperson2
)
...
...
@@ -72,3 +73,24 @@ class CourseTestCase(TestCase):
def
test_owner_list
(
self
):
owner_list
=
self
.
testcourse
.
owner_list
()
self
.
assertIsNotNone
(
owner_list
)
class
SemesterTestCase
(
TestCase
):
def
setUp
(
self
):
now
=
datetime
.
now
()
date
=
now
.
date
()
self
.
now
=
now
delta
=
timedelta
(
weeks
=
7
)
self
.
last_semester
=
Semester
.
objects
.
create
(
name
=
"testsem1"
,
start
=
date
-
3
*
delta
,
end
=
date
-
delta
)
self
.
current_semester
=
Semester
.
objects
.
create
(
name
=
"testsem2"
,
start
=
date
-
delta
,
end
=
date
+
delta
)
self
.
next_semester
=
Semester
.
objects
.
create
(
name
=
"testsem3"
,
start
=
date
+
delta
,
end
=
date
+
3
*
delta
)
def
test_is_on
(
self
):
self
.
assertFalse
(
self
.
last_semester
.
is_on
(
self
.
now
))
self
.
assertTrue
(
self
.
current_semester
.
is_on
(
self
.
now
))
self
.
assertFalse
(
self
.
next_semester
.
is_on
(
self
.
now
))
def
test_get_current
(
self
):
self
.
assertEqual
(
self
.
current_semester
,
Semester
.
get_current
())
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