FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
django-basic-apps/basic/flagging/tests.py at master · msGenDev/django-basic-apps · GitHub
msGenDev
django-basic-apps
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
django-basic-apps
/
basic
/
flagging
/
tests.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
44 lines (34 loc) · 1.55 KB
Breadcrumbs
django-basic-apps
/
basic
/
flagging
/
tests.py
Copy path
File metadata and controls
44 lines (34 loc) · 1.55 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from
django
.
test
import
TestCase
from
django
.
core
.
urlresolvers
import
reverse
from
django
.
contrib
.
auth
.
models
import
User
from
django
.
contrib
.
contenttypes
.
models
import
ContentType
from
basic
.
flagging
.
models
import
*
class
FlaggingTestCase
(
TestCase
):
fixtures
=
[
'flagging.json'
]
def
setUp
(
self
):
self
.
user
=
User
.
objects
.
get
(
username
=
'nathanb'
)
self
.
ctype
=
ContentType
.
objects
.
get_for_model
(
self
.
user
)
self
.
flag_type
=
FlagType
.
objects
.
create
(
title
=
'Test flagging'
,
slug
=
'test-flagging'
)
self
.
friend
=
User
.
objects
.
get
(
username
=
'laurah'
)
def
test_flagging
(
self
):
self
.
client
.
login
(
username
=
self
.
user
.
username
,
password
=
'n'
)
kwargs
=
{
'slug'
:
self
.
flag_type
.
slug
,
'app_label'
:
self
.
ctype
.
app_label
,
'model'
:
self
.
ctype
.
model
,
'object_id'
:
self
.
friend
.
pk
,
}
response
=
self
.
client
.
get
(
reverse
(
'flag'
,
kwargs
=
kwargs
))
self
.
assertEqual
(
response
.
status_code
,
200
)
response
=
self
.
client
.
post
(
reverse
(
'flag'
,
kwargs
=
kwargs
))
self
.
assertEqual
(
response
.
status_code
,
200
)
response
=
self
.
client
.
get
(
reverse
(
'unflag'
,
kwargs
=
kwargs
))
self
.
assertEqual
(
response
.
status_code
,
200
)
response
=
self
.
client
.
post
(
reverse
(
'unflag'
,
kwargs
=
kwargs
))
#self.assertEqual(response.status_code, 200)
kwargs
=
{
'username'
:
'nathanb'
,
'slug'
:
'test-flagging'
}
response
=
self
.
client
.
get
(
reverse
(
'user_flags'
,
kwargs
=
kwargs
))
self
.
assertEqual
(
response
.
status_code
,
200
)
Back
|
FazBrowse Home
|
New Git URL