Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
4ff3f93d
authored
Feb 17, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: test notification model
parent
c3dcd075
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
circle/dashboard/templates/dashboard/test_message.txt
+2
-0
circle/dashboard/tests/test_models.py
+27
-0
No files found.
circle/dashboard/templates/dashboard/test_message.txt
0 → 100644
View file @
4ff3f93d
This is a test for {{user.username}}.
Var: {{var}}.
circle/dashboard/tests/test_models.py
0 → 100644
View file @
4ff3f93d
from
django.contrib.auth.models
import
User
from
django.test
import
TestCase
from
..models
import
Profile
class
NotificationTestCase
(
TestCase
):
def
setUp
(
self
):
self
.
u1
=
User
.
objects
.
create
(
username
=
'user1'
)
Profile
.
objects
.
get_or_create
(
user
=
self
.
u1
)
self
.
u2
=
User
.
objects
.
create
(
username
=
'user2'
)
Profile
.
objects
.
get_or_create
(
user
=
self
.
u2
)
def
test_notification_send
(
self
):
c1
=
self
.
u1
.
notification_set
.
count
()
c2
=
self
.
u1
.
notification_set
.
count
()
profile
=
self
.
u1
.
profile
msg
=
profile
.
notify
(
'subj'
,
'dashboard/test_message.txt'
,
{
'var'
:
'testme'
})
assert
self
.
u1
.
notification_set
.
count
()
==
c1
+
1
assert
self
.
u2
.
notification_set
.
count
()
==
c2
assert
'user1'
in
msg
.
message
assert
'testme'
in
msg
.
message
assert
msg
in
self
.
u1
.
notification_set
.
all
()
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