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
790db80d
Commit
790db80d
authored
5 years ago
by
Daniel Levy
Browse files
Options
Downloads
Patches
Plain Diff
Fix potential issue with spaces between terms
parent
a23bd922
No related branches found
Branches containing commit
No related tags found
2 merge requests
!166
Staging
,
!164
Fix potential issue with spaces between terms
Checking pipeline status
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
internewshid/hid/filters.py
+1
-0
1 addition, 0 deletions
internewshid/hid/filters.py
internewshid/hid/tests/views_tests.py
+40
-0
40 additions, 0 deletions
internewshid/hid/tests/views_tests.py
with
41 additions
and
0 deletions
internewshid/hid/filters.py
+
1
−
0
View file @
790db80d
...
...
@@ -18,6 +18,7 @@ class TagsFilter(object):
tag_list
=
tags
.
split
(
'
,
'
)
filters
.
setdefault
(
'
terms
'
,
[])
for
a_tag
in
tag_list
:
a_tag
=
a_tag
.
strip
()
filters
[
'
terms
'
].
append
(
f
'
tags:
{
a_tag
}
'
)
...
...
This diff is collapsed.
Click to expand it.
internewshid/hid/tests/views_tests.py
+
40
−
0
View file @
790db80d
...
...
@@ -663,6 +663,46 @@ def test_table_items_filtered_by_all_tags_not_either():
assert
ids
==
[
third_female_item
[
'
id
'
]]
@pytest.mark.django_db
def
test_filters_not_affected_by_unecessary_spacing
():
tags
=
TaxonomyFactory
(
name
=
"
Tags
"
,
slug
=
"
tags
"
)
not_tags
=
TaxonomyFactory
(
name
=
"
Not tags
"
)
female_item
=
transport
.
items
.
create
({
'
body
'
:
'
Message from female
'
,
})
tags
=
TaxonomyFactory
(
name
=
'
Tags
'
,
slug
=
'
tags
'
)
female_term
=
TermFactory
(
name
=
'
female
'
,
taxonomy
=
tags
)
second_female_term
=
TermFactory
(
name
=
'
woman
'
,
taxonomy
=
tags
)
transport
.
items
.
add_terms
(
female_item
[
'
id
'
],
female_term
.
taxonomy
.
slug
,
female_term
.
name
)
transport
.
items
.
add_terms
(
female_item
[
'
id
'
],
second_female_term
.
taxonomy
.
slug
,
second_female_term
.
name
)
page
=
TabbedPageFactory
()
tab_instance
=
TabInstanceFactory
(
page
=
page
)
request
=
MagicMock
(
session
=
{
'
THREADED_FILTERS
'
:
{}},
GET
=
QueryDict
(
'
tags=female, woman
'
)
)
tab
=
ViewAndEditTableTab
()
context_data
=
tab
.
get_context_data
(
tab_instance
,
request
,
dynamic_filters
=
[
'
tags
'
]
)
table
=
context_data
[
'
table
'
]
ids
=
[
t
[
'
id
'
]
for
t
in
table
.
data
.
data
]
assert
ids
==
[
female_item
[
'
id
'
]]
@pytest.mark.django_db
def
test_table_items_filtered_by_feedback_type
():
rumour_1
=
transport
.
items
.
create
({
...
...
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