Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
2020
PPL-C
PPTI-Mobile Apps Monitoring Wabah Tuberkolosis
Neza-Backend
Commits
3ce596a3
Commit
3ce596a3
authored
May 27, 2020
by
Dave Nathanael
Browse files
[RED] Add test for csv export with filters
parent
7e1f0a7f
Pipeline
#47923
failed with stages
in 5 minutes and 32 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
apps/exportables/tests/test_units/test_exportables.py
View file @
3ce596a3
...
...
@@ -181,8 +181,8 @@ class ExportableViewTest(APITestCase):
self
.
assertJSONEqual
(
response
.
content
,
data
)
def
test_
export_
investigation_data_to_csv_all
(
self
):
url
=
"/exportables/investigation-cases-csv/"
def
export_
csv_test_util
(
self
,
filter
):
url
=
"/exportables/investigation-cases-csv/"
+
filter
response
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
...
...
@@ -197,4 +197,20 @@ class ExportableViewTest(APITestCase):
headers
=
body
.
pop
(
0
)
self
.
assertEqual
(
headers
,
INVESTIGATION_CASE_RENDERER_FIELDS
)
return
body
def
test_export_investigation_data_to_csv_all
(
self
):
body
=
self
.
export_csv_test_util
(
""
)
self
.
assertEqual
(
len
(
body
),
5
)
def
test_export_investigation_data_to_csv_filter_gender
(
self
):
body
=
self
.
export_csv_test_util
(
"?is_male=false"
)
self
.
assertEqual
(
len
(
body
),
2
)
def
test_export_investigation_data_to_csv_filter_age
(
self
):
body
=
self
.
export_csv_test_util
(
"?age=21"
)
self
.
assertEqual
(
len
(
body
),
2
)
def
test_export_investigation_data_to_csv_filter_district
(
self
):
body
=
self
.
export_csv_test_util
(
"?district=Beji"
)
self
.
assertEqual
(
len
(
body
),
1
)
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