Skip to content
GitLab
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
5e4aaacf
Commit
5e4aaacf
authored
Jul 10, 2019
by
Okhin
Browse files
We need an actual dict without None as parameters for forms
parent
32ce8428
Pipeline
#2640
failed with stages
in 40 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
apps/rp/tests/test_article.py
View file @
5e4aaacf
...
...
@@ -202,11 +202,13 @@ class TestArticleViews(TestCase):
self
.
client
.
force_login
(
user
=
self
.
user
)
pk
=
self
.
articles
[
0
].
pk
fields
=
{
'title'
:
'Zog Zog'
}
r
=
self
.
client
.
post
(
'/rp/article/edit/{}/'
.
format
(
pk
),
fields
)
a
=
{
'title'
:
'Zog Zog'
,
'status'
:
'NEW'
,
'lang'
:
'FR'
,
'url'
:
'https://www.example.org/'
}
r
=
self
.
client
.
post
(
'/rp/article/edit/{}/'
.
format
(
pk
),
a
)
a
=
Article
.
objects
.
get
(
pk
=
pk
)
assert
r
.
status_code
==
302
# We're redirecting
after edit
assert
r
.
status_code
==
302
# We're redirecting
to the view or preview of the article
assert
a
.
title
==
'Zog Zog'
...
...
@@ -244,8 +246,8 @@ class TestArticleApi(TestCase):
article
=
{
'title'
:
'Zog Zog'
,
'url'
:
'https://article.org/Zog+Zog'
}
r
=
self
.
client
.
put
(
'/api/articles/{}/'
.
format
(
pk
),
article
,
format
=
'json'
)
article
,
format
=
'json'
)
assert
r
.
status_code
==
200
assert
Article
.
objects
.
get
(
pk
=
pk
).
title
==
'Zog Zog'
...
...
@@ -266,7 +268,7 @@ class TestArticleApi(TestCase):
assert
r
.
status_code
==
200
a
=
Article
.
objects
.
get
(
pk
=
pk
)
assert
list
(
a
.
tags
.
values
(
'name'
,).
order_by
(
'name'
))
==
[{
'name'
:
'New Tag 1'
},
{
'name'
:
'New Tag 2'
}]
{
'name'
:
'New Tag 2'
}]
def
test_api_filter_tag
(
self
):
tag
=
'Tag 1'
...
...
@@ -347,7 +349,7 @@ class TestArticleApi(TestCase):
# We cannot recover a published article
a
=
ArticleFactory
(
status
=
'PUBLISHED'
)
r
=
self
.
client
.
post
(
'/api/articles/{}/recover/'
.
format
(
a
.
id
))
assert
r
.
status_code
==
40
3
assert
r
.
status_code
==
40
0
def
test_api_set_priority
(
self
):
self
.
user
.
user_permissions
.
add
(
Permission
.
objects
.
get
(
...
...
@@ -355,7 +357,7 @@ class TestArticleApi(TestCase):
self
.
client
.
force_login
(
user
=
self
.
user
)
a
=
ArticleFactory
(
status
=
'DRAFT'
)
assert
a
.
priority
is
False
r
=
self
.
client
.
post
(
'/api/articles/{}/set
_
priority/'
.
format
(
a
.
id
))
r
=
self
.
client
.
post
(
'/api/articles/{}/set
-
priority/'
.
format
(
a
.
id
))
assert
r
.
status_code
==
200
assert
r
.
data
[
'priority'
]
...
...
@@ -365,6 +367,6 @@ class TestArticleApi(TestCase):
self
.
client
.
force_login
(
user
=
self
.
user
)
a
=
ArticleFactory
(
status
=
'DRAFT'
,
priority
=
True
)
assert
a
.
priority
r
=
self
.
client
.
post
(
'/api/articles/{}/unset
_
priority/'
.
format
(
a
.
id
))
r
=
self
.
client
.
post
(
'/api/articles/{}/unset
-
priority/'
.
format
(
a
.
id
))
assert
r
.
status_code
==
200
assert
r
.
data
[
'priority'
]
is
False
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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