Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
internewshid
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
aptivate
client-projects
internewshid
Commits
fee4514f
Commit
fee4514f
authored
9 years ago
by
Alice Heaton
Browse files
Options
Downloads
Patches
Plain Diff
Add tests ViewItems.get_request_parameters
parent
054c5727
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
django/website/hid/tests/views_tests.py
+40
-1
40 additions, 1 deletion
django/website/hid/tests/views_tests.py
with
40 additions
and
1 deletion
django/website/hid/tests/views_tests.py
+
40
−
1
View file @
fee4514f
...
...
@@ -2,7 +2,7 @@ import pytest
from
django.contrib.messages.storage.fallback
import
FallbackStorage
from
django.core.urlresolvers
import
reverse
from
django.http
import
HttpResponseRedirect
from
django.http
import
HttpResponseRedirect
,
QueryDict
from
django.test
import
RequestFactory
from
..views
import
(
...
...
@@ -156,3 +156,42 @@ def test_get_category_options_with_no_taxonomy_returns_all():
assert
(
type_1
.
name
,
type_1
.
long_name
)
in
options
assert
(
other_term
.
name
,
other_term
.
long_name
)
in
options
def
test_views_item_get_request_parameters_renames_items_of_active_location
():
query
=
QueryDict
(
'
action=something-bottom&item-top=top-value&item-bottom=bottom-value
'
)
expected
=
{
'
action
'
:
'
something
'
,
'
item
'
:
'
bottom-value
'
,
'
item-top
'
:
'
top-value
'
}
actual
=
ViewItems
.
get_request_parameters
(
query
)
assert
actual
.
dict
()
==
expected
def
test_views_item_get_request_parameters_sets_default_location
():
query
=
QueryDict
(
'
action=something&item-top=top-value&item-bottom=bottom-value
'
)
expected
=
{
'
action
'
:
'
something
'
,
'
item
'
:
'
top-value
'
,
'
item-bottom
'
:
'
bottom-value
'
}
actual
=
ViewItems
.
get_request_parameters
(
query
)
assert
actual
.
dict
()
==
expected
def
test_views_item_get_request_parameters_sets_default_action_and_location
():
query
=
QueryDict
(
'
item-top=value&item-bottom=unchanged
'
)
expected
=
{
'
action
'
:
'
none
'
,
'
item
'
:
'
value
'
,
'
item-bottom
'
:
'
unchanged
'
}
actual
=
ViewItems
.
get_request_parameters
(
query
)
assert
actual
.
dict
()
==
expected
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment