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
rp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
14
Issues
14
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
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
La Quadrature du Net
rpteam
rp
Commits
5e4aaacf
Commit
5e4aaacf
authored
Jul 10, 2019
by
Okhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
apps/rp/tests/test_article.py
apps/rp/tests/test_article.py
+12
-10
No files found.
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
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