Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
La Quadrature du Net
rpteam
Revue de Press
Commits
acd7adfd
Commit
acd7adfd
authored
Jul 02, 2019
by
Okhin
Browse files
Testing updating the article
parent
a0d3c790
Pipeline
#2631
passed with stages
in 3 minutes and 15 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
apps/rp/tests/test_article.py
View file @
acd7adfd
...
...
@@ -179,6 +179,24 @@ class TestArticleViews(TestCase):
r
=
self
.
client
.
get
(
'/rp/article/view/{}'
.
format
(
a
.
pk
))
assert
r
.
context
[
'object'
]
==
a
def
test_article_edit_unauth
(
self
):
a
=
self
.
articles
[
0
]
r
=
self
.
client
.
post
(
'/rp/article/edit/{}'
.
format
(
a
.
pk
))
assert
r
.
status_code
==
403
def
test_article_edit
(
self
):
self
.
user
.
user_permissions
.
add
(
Permission
.
objects
.
get
(
codename
=
'can_edit'
))
self
.
client
.
force_login
(
user
=
self
.
user
)
a
=
self
.
articles
[
0
]
a
.
title
=
'Zog Zog'
a
.
screenshot
=
'/tmp/{}.png'
.
format
(
a
.
pk
)
r
=
self
.
client
.
post
(
'/rp/article/edit/{}'
.
format
(
a
.
pk
),
a
.
__dict__
)
a
.
refresh_from_db
()
assert
r
.
status_code
==
302
assert
a
.
title
==
'Zog Zog'
class
TestArticleApi
(
TestCase
):
def
setUp
(
self
):
...
...
@@ -267,7 +285,7 @@ class TestArticleApi(TestCase):
r
=
self
.
client
.
post
(
'/api/articles/{}/recover/'
.
format
(
a
.
id
))
assert
r
.
status_code
==
403
# Can we recovr a NEW article and force it to DRAFT?
# Can we recov
e
r a NEW article and force it to DRAFT?
self
.
user
.
user_permissions
.
add
(
Permission
.
objects
.
get
(
codename
=
'can_change_status'
))
self
.
client
.
force_login
(
user
=
self
.
user
)
...
...
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