Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
db60e34b
authored
Mar 26, 2013
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
school: tests for Course
parent
2d558f36
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 @
db60e34b
from
django.test
import
TestCase
from
models
import
create_user_profile
,
Person
from
models
import
create_user_profile
,
Person
,
Course
,
Semester
from
datetime
import
datetime
,
timedelta
class
MockUser
:
username
=
"testuser"
...
...
@@ -50,3 +51,24 @@ class PersonTestCase(TestCase):
def
test_unicode
(
self
):
# TODO
self
.
testperson
.
__unicode__
()
class
CourseTestCase
(
TestCase
):
def
setUp
(
self
):
now
=
datetime
.
now
()
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
)
self
.
testcourse
=
Course
.
objects
.
create
(
code
=
"testcode"
,
name
=
"testname"
,
short_name
=
"tn"
)
self
.
testcourse
.
owners
.
add
(
self
.
testperson1
,
self
.
testperson2
)
def
test_get_or_create_default_group
(
self
):
default_group
=
self
.
testcourse
.
get_or_create_default_group
()
self
.
assertIsNotNone
(
default_group
)
self
.
assertEquals
(
default_group
,
self
.
testcourse
.
default_group
)
def
test_owner_list
(
self
):
owner_list
=
self
.
testcourse
.
owner_list
()
self
.
assertIsNotNone
(
owner_list
)
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