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
PPL Sosial
bisago
bisago-be
Commits
3d7c2c19
Commit
3d7c2c19
authored
May 29, 2021
by
Muhammad Rafif Elfazri
Browse files
Merge branch 'PBI-12-info_kegiatan' into 'development'
Pbi 12 info kegiatan See merge request
!56
parents
c83046cb
13a684cd
Pipeline
#79369
passed with stages
in 23 minutes and 9 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
informasi_fasilitas/serializers.py
View file @
3d7c2c19
...
...
@@ -73,7 +73,7 @@ class KegiatanSerializerRead(KegiatanSerializer):
time
=
obj
.
time_start
zona_waktu
=
obj
.
zona_waktu
time
=
time_converter
(
time
,
zona_waktu
)
return
time
.
strftime
(
'%Y-%m-%dT%H:%M
%z
'
)
return
time
.
strftime
(
'%Y-%m-%dT%H:%M'
)
def
get_time_end
(
self
,
obj
):
time
=
obj
.
time_end
...
...
@@ -81,7 +81,7 @@ class KegiatanSerializerRead(KegiatanSerializer):
if
time
is
None
:
return
None
time
=
time_converter
(
time
,
zona_waktu
)
return
time
.
strftime
(
'%Y-%m-%dT%H:%M
%z
'
)
return
time
.
strftime
(
'%Y-%m-%dT%H:%M'
)
class
KomentarKegiatanSerializer
(
serializers
.
ModelSerializer
):
...
...
informasi_fasilitas/test_views_kegiatan.py
View file @
3d7c2c19
...
...
@@ -20,6 +20,8 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
super
().
setUp
()
self
.
media_root
=
os
.
path
.
join
(
settings
.
BASE_DIR
,
'test_file/media'
)
self
.
kegiatan
=
self
.
create_kegiatan_test
(
self
.
user
,
self
.
lokasi
)
self
.
kegiatan_time_start
=
self
.
kegiatan
.
time_start
[:
16
]
self
.
kegiatan_time_end
=
self
.
kegiatan
.
time_end
[:
16
]
self
.
kwargs_place_id
=
{
'place_id'
:
self
.
lokasi
.
place_id
}
self
.
kwargs_add_or_update_kegiatan
=
{
'place_id'
:
self
.
lokasi
.
place_id
,
...
...
@@ -99,8 +101,9 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
data
.
pop
(
"id"
,
None
)
expected_json
=
self
.
mock_kegiatan_test
.
copy
()
expected_json
.
update
({
'creator'
:
'mock last_name'
,
'place_id'
:
'mock_place_id'
})
'place_id'
:
'mock_place_id'
,
'time_start'
:
self
.
kegiatan_time_start
,
'time_end'
:
self
.
kegiatan_time_end
})
self
.
assertEqual
(
response
.
status_code
,
HTTPStatus
.
CREATED
)
self
.
assertDictEqual
(
data
,
expected_json
)
count
=
Kegiatan
.
objects
.
all
().
count
()
...
...
@@ -141,8 +144,8 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
'nama_kontak'
:
self
.
kegiatan
.
nama_kontak
,
'nomor_kontak'
:
self
.
kegiatan
.
nomor_kontak
,
'zona_waktu'
:
self
.
kegiatan
.
zona_waktu
,
'time_start'
:
self
.
kegiatan
.
time_start
,
'time_end'
:
self
.
kegiatan
.
time_end
,
'time_start'
:
self
.
kegiatan
_
time_start
,
'time_end'
:
self
.
kegiatan
_
time_end
,
},
}
self
.
assertEqual
(
content
,
expected_json
)
...
...
@@ -162,8 +165,8 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
'nama_kontak'
:
self
.
kegiatan
.
nama_kontak
,
'nomor_kontak'
:
self
.
kegiatan
.
nomor_kontak
,
'zona_waktu'
:
self
.
kegiatan
.
zona_waktu
,
'time_start'
:
self
.
kegiatan
.
time_start
,
'time_end'
:
self
.
kegiatan
.
time_end
,
'time_start'
:
self
.
kegiatan
_
time_start
,
'time_end'
:
self
.
kegiatan
_
time_end
,
}
self
.
assertEqual
(
content
,
expected_json
)
...
...
@@ -190,8 +193,8 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
'nama_kontak'
:
kegiatan_wita
.
nama_kontak
,
'nomor_kontak'
:
kegiatan_wita
.
nomor_kontak
,
'zona_waktu'
:
kegiatan_wita
.
zona_waktu
,
'time_start'
:
kegiatan_wita
.
time_start
,
'time_end'
:
kegiatan_wita
.
time_end
,
'time_start'
:
kegiatan_wita
.
time_start
[:
16
]
,
'time_end'
:
kegiatan_wita
.
time_end
[:
16
]
,
}
self
.
assertDictEqual
(
content
,
expected_json
)
...
...
@@ -218,8 +221,8 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
'nama_kontak'
:
kegiatan_wit
.
nama_kontak
,
'nomor_kontak'
:
kegiatan_wit
.
nomor_kontak
,
'zona_waktu'
:
kegiatan_wit
.
zona_waktu
,
'time_start'
:
kegiatan_wit
.
time_start
,
'time_end'
:
kegiatan_wit
.
time_end
,
'time_start'
:
kegiatan_wit
.
time_start
[:
16
]
,
'time_end'
:
kegiatan_wit
.
time_end
[:
16
]
,
}
self
.
assertDictEqual
(
content
,
expected_json
)
...
...
@@ -238,8 +241,8 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
'nama_kontak'
:
self
.
kegiatan
.
nama_kontak
,
'nomor_kontak'
:
self
.
kegiatan
.
nomor_kontak
,
'zona_waktu'
:
self
.
kegiatan
.
zona_waktu
,
'time_start'
:
self
.
kegiatan
.
time_start
,
'time_end'
:
self
.
kegiatan
.
time_end
,
'time_start'
:
self
.
kegiatan
_
time_start
,
'time_end'
:
self
.
kegiatan
_
time_end
,
}
self
.
assertEqual
(
content
,
expected_json
)
...
...
@@ -261,8 +264,10 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
data
.
pop
(
"id"
,
None
)
expected_json
=
self
.
mock_kegiatan_test
.
copy
()
expected_json
.
update
({
'creator'
:
'mock last_name'
,
'place_id'
:
'mock_place_id'
})
'place_id'
:
'mock_place_id'
,
'time_start'
:
self
.
kegiatan_time_start
,
'time_end'
:
self
.
kegiatan_time_end
})
send_data
.
pop
(
"images"
)
expected_json
.
update
(
send_data
)
self
.
assertEqual
(
response
.
status_code
,
HTTPStatus
.
ACCEPTED
)
...
...
@@ -313,8 +318,8 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
'nama_kontak'
:
self
.
kegiatan
.
nama_kontak
,
'nomor_kontak'
:
self
.
kegiatan
.
nomor_kontak
,
'zona_waktu'
:
self
.
kegiatan
.
zona_waktu
,
'time_start'
:
self
.
kegiatan
.
time_start
,
'time_end'
:
self
.
kegiatan
.
time_end
,
'time_start'
:
self
.
kegiatan
_
time_start
,
'time_end'
:
self
.
kegiatan
_
time_end
,
},
}
self
.
assertEqual
(
content
,
expected_json
)
...
...
@@ -375,9 +380,9 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
response_id_in_order
=
list
(
content
.
keys
())
self
.
assertEqual
(
content
[
base_mock_id
][
'time_start'
],
self
.
kegiatan
.
time_start
)
self
.
kegiatan
_
time_start
)
self
.
assertEqual
(
content
[
ordered_time_mock_id
][
'time_start'
],
self
.
mock_kegiatan_time_order_test
[
'time_start'
])
self
.
mock_kegiatan_time_order_test
[
'time_start'
]
[:
16
]
)
self
.
assertEqual
(
response_id_in_order
[
0
],
base_mock_id
)
self
.
assertEqual
(
response_id_in_order
[
1
],
ordered_time_mock_id
)
...
...
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