Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
roomlist
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
23
Issues
23
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SRCT
roomlist
Commits
00d095cd
Commit
00d095cd
authored
Dec 31, 2015
by
Daniel W Bond
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
that was supposed to be a git mv-- started writing tests for account models
parent
bdd01530
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
6 deletions
+72
-6
roomlist/accounts/test_models.py
roomlist/accounts/test_models.py
+72
-0
roomlist/accounts/tests.py
roomlist/accounts/tests.py
+0
-6
No files found.
roomlist/accounts/test_models.py
0 → 100644
View file @
00d095cd
# standard library imports
from
__future__
import
absolute_import
,
print_function
# core django imports
from
django.test
import
Client
,
TestCase
from
django.contrib.auth.models
import
User
# imports from your apps
from
accounts.models
import
Student
,
Major
from
housing.models
import
Building
,
Floor
,
Room
class
MajorTest
(
TestCase
):
def
setUp
(
self
):
Major
.
objects
.
create
(
name
=
'Government and International Politics, BA'
)
def
test_major_first_letter
(
self
):
govt
=
Major
.
objects
.
get
(
name
=
'Government and International Politics, BA'
)
self
.
assertEqual
(
govt
.
first_letter
(),
'G'
)
class
StudentTest
(
TestCase
):
def
setUp
(
self
):
gmason
=
User
.
objects
.
create_user
(
username
=
'gmason'
,
first_name
=
'George'
,
last_name
=
'Mason'
,
email
=
'gmason@masonlive.gmu.edu'
,
password
=
'eagle_bank'
)
dmadison
=
User
.
objects
.
create_user
(
username
=
'dmadison'
,
email
=
'dmadison@masonlive.gmu.edu'
,
password
=
'white_house'
)
Student
.
objects
.
create
(
user
=
gmason
)
Student
.
objects
.
create
(
user
=
dmadison
)
def
test_recent_changes
(
self
):
george
=
Student
.
objects
.
get
(
user__username
=
'gmason'
)
self
.
assertEqual
(
george
.
recent_changes
(),
0
)
def
test_totally_done
(
self
):
# one assert per test?
george
=
Student
.
objects
.
get
(
user__username
=
'gmason'
)
self
.
assertEqual
(
george
.
totally_done
(),
False
)
george
.
completedName
=
True
self
.
assertEqual
(
george
.
totally_done
(),
False
)
george
.
completedPrivacy
=
True
self
.
assertEqual
(
george
.
totally_done
(),
False
)
george
.
completedMajor
=
True
self
.
assertEqual
(
george
.
totally_done
(),
False
)
george
.
completedSocial
=
True
self
.
assertEqual
(
george
.
totally_done
(),
True
)
def
test_get_flag_count
(
self
):
george
=
Student
.
objects
.
get
(
user__username
=
'gmason'
)
self
.
assertEqual
(
george
.
get_flag_count
(),
0
)
def
test_get_first_name_or_uname
(
self
):
george
=
Student
.
objects
.
get
(
user__username
=
'gmason'
)
self
.
assertEqual
(
george
.
get_first_name_or_uname
(),
'George'
)
dolley
=
Student
.
objects
.
get
(
user__username
=
'dmadison'
)
self
.
assertEqual
(
dolley
.
get_first_name_or_uname
(),
'dmadison'
)
def
test_get_last_name_or_uname
(
self
):
george
=
Student
.
objects
.
get
(
user__username
=
'gmason'
)
self
.
assertEqual
(
george
.
get_last_name_or_uname
(),
'Mason'
)
dolley
=
Student
.
objects
.
get
(
user__username
=
'dmadison'
)
self
.
assertEqual
(
dolley
.
get_last_name_or_uname
(),
'dmadison'
)
def
test_get_full_name_or_uname
(
self
):
george
=
Student
.
objects
.
get
(
user__username
=
'gmason'
)
self
.
assertEqual
(
george
.
get_full_name_or_uname
(),
'George Mason'
)
dolley
=
Student
.
objects
.
get
(
user__username
=
'dmadison'
)
self
.
assertEqual
(
dolley
.
get_full_name_or_uname
(),
'dmadison'
)
roomlist/accounts/tests.py
deleted
100644 → 0
View file @
bdd01530
# standard library imports
from
__future__
import
absolute_import
,
print_function
# core django imports
from
django.test
import
TestCase
# Create your tests here.
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