Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
amundsen_dev
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Surendar Reddy Mangannagari
amundsen_dev
Commits
636a7379
Commit
636a7379
authored
Jan 13, 2020
by
Alyssa
Committed by
Tamika Tannis
Jan 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle get bookmark failure properly (#367)
parent
c12671b7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
v0.py
amundsen_application/api/metadata/v0.py
+9
-3
test_v0.py
tests/unit/api/metadata/test_v0.py
+14
-0
No files found.
amundsen_application/api/metadata/v0.py
View file @
636a7379
...
@@ -445,10 +445,16 @@ def get_bookmark() -> Response:
...
@@ -445,10 +445,16 @@ def get_bookmark() -> Response:
response
=
request_metadata
(
url
=
url
,
method
=
request
.
method
)
response
=
request_metadata
(
url
=
url
,
method
=
request
.
method
)
status_code
=
response
.
status_code
status_code
=
response
.
status_code
if
status_code
==
HTTPStatus
.
OK
:
message
=
'Success'
tables
=
response
.
json
()
.
get
(
'table'
)
tables
=
response
.
json
()
.
get
(
'table'
)
table_bookmarks
=
[
marshall_table_partial
(
table
)
for
table
in
tables
]
table_bookmarks
=
[
marshall_table_partial
(
table
)
for
table
in
tables
]
else
:
message
=
f
'Encountered error: failed to get bookmark for user_id: {user_id}'
logging
.
error
(
message
)
table_bookmarks
=
[]
return
make_response
(
jsonify
({
'msg'
:
'success'
,
'bookmarks'
:
table_bookmarks
}),
status_code
)
return
make_response
(
jsonify
({
'msg'
:
message
,
'bookmarks'
:
table_bookmarks
}),
status_code
)
except
Exception
as
e
:
except
Exception
as
e
:
message
=
'Encountered exception: '
+
str
(
e
)
message
=
'Encountered exception: '
+
str
(
e
)
logging
.
exception
(
message
)
logging
.
exception
(
message
)
...
...
tests/unit/api/metadata/test_v0.py
View file @
636a7379
...
@@ -591,6 +591,20 @@ class MetadataTest(unittest.TestCase):
...
@@ -591,6 +591,20 @@ class MetadataTest(unittest.TestCase):
self
.
assertEquals
(
response
.
status_code
,
HTTPStatus
.
OK
)
self
.
assertEquals
(
response
.
status_code
,
HTTPStatus
.
OK
)
self
.
assertCountEqual
(
data
.
get
(
'bookmarks'
),
self
.
expected_parsed_user_resources
)
self
.
assertCountEqual
(
data
.
get
(
'bookmarks'
),
self
.
expected_parsed_user_resources
)
@
responses
.
activate
def
test_get_bookmark_failure
(
self
)
->
None
:
"""
Test correct response returned when get_bookmark fails
"""
url
=
f
"{local_app.config['METADATASERVICE_BASE']}{USER_ENDPOINT}/{TEST_USER_ID}/follow/"
responses
.
add
(
responses
.
GET
,
url
,
json
=
self
.
mock_user
,
status
=
HTTPStatus
.
BAD_REQUEST
)
with
local_app
.
test_client
()
as
test
:
response
=
test
.
get
(
'/api/metadata/v0/user/bookmark'
)
self
.
assertEqual
(
response
.
status_code
,
HTTPStatus
.
BAD_REQUEST
)
expected
=
{
'bookmarks'
:
[],
'msg'
:
'Encountered error: failed to get bookmark for user_id: test_user_id'
}
self
.
assertEqual
(
response
.
json
,
expected
)
@
responses
.
activate
@
responses
.
activate
def
test_get_bookmark_for_user
(
self
)
->
None
:
def
test_get_bookmark_for_user
(
self
)
->
None
:
"""
"""
...
...
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