Skip to content

Commit

Permalink
chore: Upgrade flask to 2.2.5 and its related dependencies (#2237)
Browse files Browse the repository at this point in the history
* Upgrade flask and related dependencies

Signed-off-by: Kristen Armes <karmes@lyft.com>

* Fix frontend tests

Signed-off-by: Kristen Armes <karmes@lyft.com>

* Fixing more tests

Signed-off-by: Kristen Armes <karmes@lyft.com>

* Revert databuilder version bump, changes don't affect it

Signed-off-by: Kristen Armes <karmes@lyft.com>

---------

Signed-off-by: Kristen Armes <karmes@lyft.com>
  • Loading branch information
kristenarmes committed Mar 6, 2024
1 parent 0602992 commit 125b04f
Show file tree
Hide file tree
Showing 19 changed files with 78 additions and 73 deletions.
4 changes: 2 additions & 2 deletions common/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from setuptools import find_packages, setup

__version__ = '0.31.0'
__version__ = '0.32.0'


requirements_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'requirements-dev.txt')
Expand Down Expand Up @@ -38,7 +38,7 @@
# This will allow for any consuming projects to use this library as
# long as they have a version of pyfoobar equal to or greater than 1.x
# and less than 2.x installed.
'Flask>=1.0.2',
'Flask>=2.2.5',
'attrs>=19.0.0',
'marshmallow>=3.0',
'marshmallow3-annotations>=1.1.0'
Expand Down
8 changes: 4 additions & 4 deletions frontend/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ def build_js() -> None:
with open(requirements_path) as requirements_file:
requirements_dev = requirements_file.readlines()

__version__ = '4.2.1'
__version__ = '4.3.0'

jira = ['jira==3.0.1']
asana = ['asana==0.10.3']
oidc = ['flaskoidc>=1.0.0']
pyarrrow = ['pyarrow==3.0.0']
pyarrow = ['pyarrow==3.0.0']
bigquery_preview = ['google-cloud-bigquery>=2.13.1,<3.0.0', 'flatten-dict==0.3.0']
all_deps = requirements + requirements_common + requirements_dev + oidc + pyarrrow + bigquery_preview + jira + asana
all_deps = requirements + requirements_common + requirements_dev + oidc + pyarrow + bigquery_preview + jira + asana

setup(
name='amundsen-frontend',
Expand All @@ -69,7 +69,7 @@ def build_js() -> None:
extras_require={
'oidc': oidc,
'dev': requirements_dev,
'pyarrow': pyarrrow,
'pyarrow': pyarrow,
'bigquery_preview': bigquery_preview,
'jira': jira,
'asana': asana,
Expand Down
23 changes: 11 additions & 12 deletions frontend/tests/unit/api/issue/test_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def test_create_issue_not_enabled(self) -> None:
"""
local_app.config['ISSUE_TRACKER_CLIENT_ENABLED'] = False
with local_app.test_client() as test:
response = test.post('/api/issue/issue', data={
response = test.post('/api/issue/issue', json={
'description': 'test description',
'owner_ids': ['user1@email.com', 'user2@email.com'],
'frequent_user_ids': ['user1@email.com', 'user2@email.com'],
Expand All @@ -127,7 +127,7 @@ def test_create_jira_issue_missing_config(self, mock_issue_tracker_client: unitt
mock_issue_tracker_client.side_effect = IssueConfigurationException
local_app.config['ISSUE_TRACKER_URL'] = None
with local_app.test_client() as test:
response = test.post('/api/issue/issue', data={
response = test.post('/api/issue/issue', json={
'description': 'test description',
'owner_ids': ['user1@email.com', 'user2@email.com'],
'frequent_user_ids': ['user1@email.com', 'user2@email.com'],
Expand All @@ -145,7 +145,7 @@ def test_create_jira_issue_no_description(self) -> None:
:return:
"""
with local_app.test_client() as test:
response = test.post('/api/issue/issue', data={
response = test.post('/api/issue/issue', json={
'owner_ids': ['user1@email.com', 'user2@email.com'],
'frequent_user_ids': ['user1@email.com', 'user2@email.com'],
'priority_level': 'P2',
Expand All @@ -162,7 +162,7 @@ def test_create_jira_issue_no_key(self) -> None:
:return:
"""
with local_app.test_client() as test:
response = test.post('/api/issue/issue', data={
response = test.post('/api/issue/issue', json={
'description': 'test description',
'owner_ids': ['user1@email.com', 'user2@email.com'],
'frequent_user_ids': ['user1@email.com', 'user2@email.com'],
Expand All @@ -179,7 +179,7 @@ def test_create_jira_issue_no_title(self) -> None:
:return:
"""
with local_app.test_client() as test:
response = test.post('/api/issue/issue', data={
response = test.post('/api/issue/issue', json={
'description': 'test description',
'owner_ids': ['user1@email.com', 'user2@email.com'],
'frequent_user_ids': ['user1@email.com', 'user2@email.com'],
Expand All @@ -196,7 +196,7 @@ def test_create_jira_issue_no_resource_path(self) -> None:
:return:
"""
with local_app.test_client() as test:
response = test.post('/api/issue/issue', data={
response = test.post('/api/issue/issue', json={
'description': 'test description',
'owner_ids': ['user1@email.com', 'user2@email.com'],
'frequent_user_ids': ['user1@email.com', 'user2@email.com'],
Expand All @@ -213,7 +213,7 @@ def test_create_jira_issue_no_priority(self) -> None:
:return:
"""
with local_app.test_client() as test:
response = test.post('/api/issue/issue', data={
response = test.post('/api/issue/issue', json={
'description': 'test description',
'owner_ids': ['user1@email.com', 'user2@email.com'],
'frequent_user_ids': ['user1@email.com', 'user2@email.com'],
Expand All @@ -230,7 +230,7 @@ def test_create_jira_issue_no_owner_ids(self) -> None:
:return:
"""
with local_app.test_client() as test:
response = test.post('/api/issue/issue', data={
response = test.post('/api/issue/issue', json={
'description': 'test description',
'frequent_user_ids': ['user1@email.com', 'user2@email.com'],
'priority_level': 'P2',
Expand All @@ -247,7 +247,7 @@ def test_create_jira_issue_no_frequent_user_ids(self) -> None:
:return:
"""
with local_app.test_client() as test:
response = test.post('/api/issue/issue', data={
response = test.post('/api/issue/issue', json={
'description': 'test description',
'owner_ids': ['user1@email.com', 'user2@email.com'],
'priority_level': 'P2',
Expand All @@ -264,7 +264,7 @@ def test_create_jira_issue_no_project_key(self) -> None:
:return:
"""
with local_app.test_client() as test:
response = test.post('/api/issue/issue', data={
response = test.post('/api/issue/issue', json={
'description': 'test description',
'owner_ids': ['user1@email.com', 'user2@email.com'],
'frequent_user_ids': ['user1@email.com', 'user2@email.com'],
Expand All @@ -285,8 +285,7 @@ def test_create_jira_issue_success(self, mock_issue_tracker_client: unittest.moc

with local_app.test_client() as test:
response = test.post('/api/issue/issue',
content_type='multipart/form-data',
data={
json={
'description': 'test description',
'owner_ids': ['user1@email.com', 'user2@email.com'],
'frequent_user_ids': ['user1@email.com', 'user2@email.com'],
Expand Down
10 changes: 5 additions & 5 deletions frontend/tests/unit/api/preview/test_v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_no_client_class(self) -> None:

local_app.config['PREVIEW_CLIENT'] = None
with local_app.test_client() as test:
response = test.post('/api/preview/v0/')
response = test.post('/api/preview/v0/', json={})
self.assertEqual(response.status_code, HTTPStatus.NOT_IMPLEMENTED)

@unittest.mock.patch(PREVIEW_CLIENT_CLASS + '.get_preview_data')
Expand All @@ -51,7 +51,7 @@ def test_good_client_response(self, mock_get_preview_data: unittest.mock.Mock) -
mock_get_preview_data.return_value = Response(response=response,
status=HTTPStatus.OK)
with local_app.test_client() as test:
post_response = test.post('/api/preview/v0/')
post_response = test.post('/api/preview/v0/', json={})
self.assertEqual(post_response.status_code, HTTPStatus.OK)
self.assertEqual(post_response.json, expected_response_json)

Expand All @@ -69,7 +69,7 @@ def test_bad_client_response(self, mock_get_preview_data: unittest.mock.Mock) ->
mock_get_preview_data.return_value = Response(response=response,
status=HTTPStatus.OK)
with local_app.test_client() as test:
post_response = test.post('/api/preview/v0/')
post_response = test.post('/api/preview/v0/', json={})
self.assertEqual(post_response.status_code,
HTTPStatus.INTERNAL_SERVER_ERROR)
self.assertEqual(post_response.json, expected_response_json)
Expand All @@ -90,7 +90,7 @@ def test_good_client_response_feature(self, mock_get_preview_data: unittest.mock
mock_get_preview_data.return_value = Response(response=response,
status=HTTPStatus.OK)
with local_app.test_client() as test:
post_response = test.post('/api/preview/v0/feature_preview')
post_response = test.post('/api/preview/v0/feature_preview', json={})
self.assertEqual(post_response.status_code, HTTPStatus.OK)
self.assertEqual(post_response.json, expected_response_json)

Expand All @@ -108,7 +108,7 @@ def test_bad_client_response_feature(self, mock_get_preview_data: unittest.mock.
mock_get_preview_data.return_value = Response(response=response,
status=HTTPStatus.OK)
with local_app.test_client() as test:
post_response = test.post('/api/preview/v0/feature_preview')
post_response = test.post('/api/preview/v0/feature_preview', json={})
self.assertEqual(post_response.status_code,
HTTPStatus.INTERNAL_SERVER_ERROR)
self.assertEqual(post_response.json, expected_response_json)
2 changes: 1 addition & 1 deletion metadata/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from setuptools import find_packages, setup

__version__ = '3.12.3'
__version__ = '3.13.0'

requirements_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'requirements.txt')
with open(requirements_path) as requirements_file:
Expand Down
9 changes: 6 additions & 3 deletions metadata/tests/unit/api/column/test_column_badge_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,26 @@ def tearDown(self) -> None:
def test_block_bad_badge_name(self) -> None:
self.app.config['WHITELIST_BADGES'] = []
response = self.app.test_client().put(f'/table/{TABLE_NAME}/column/{COLUMN_NAME}'
f'/badge/{BADGE_NAME}?category=table_status')
f'/badge/{BADGE_NAME}?category=table_status',
json={})

self.assertEqual(response.status_code, HTTPStatus.NOT_FOUND)

def test_block_badge_missing_category(self) -> None:
self.app.config['WHITELIST_BADGES'] = [Badge(badge_name='alpha',
category='table_status')]
response = self.app.test_client().put(f'/table/{TABLE_NAME}/column/{COLUMN_NAME}'
f'/badge/{BADGE_NAME}')
f'/badge/{BADGE_NAME}',
json={})

self.assertEqual(response.status_code, HTTPStatus.BAD_REQUEST)

def test_badge_with_category(self) -> None:
self.app.config['WHITELIST_BADGES'] = [Badge(badge_name='alpha',
category='table_status')]
response = self.app.test_client().put(f'/table/{TABLE_NAME}/column/{COLUMN_NAME}'
f'/badge/{BADGE_NAME}?category=table_status')
f'/badge/{BADGE_NAME}?category=table_status',
json={})

self.assertEqual(response.status_code, HTTPStatus.OK)

Expand Down
9 changes: 6 additions & 3 deletions metadata/tests/unit/api/dashboard/test_dashboard_badge_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,24 @@ def tearDown(self) -> None:

def test_block_bad_badge_name(self) -> None:
self.app.config['WHITELIST_BADGES'] = []
response = self.app.test_client().put(f'/dashboard/{DASHBOARD_NAME}/badge/{BADGE_NAME}?category=table_status')
response = self.app.test_client().put(f'/dashboard/{DASHBOARD_NAME}/badge/{BADGE_NAME}?category=table_status',
json={})

self.assertEqual(response.status_code, HTTPStatus.NOT_FOUND)

def test_block_badge_missing_category(self) -> None:
self.app.config['WHITELIST_BADGES'] = [Badge(badge_name='alpha',
category='table_status')]
response = self.app.test_client().put(f'/dashboard/{DASHBOARD_NAME}/badge/{BADGE_NAME}')
response = self.app.test_client().put(f'/dashboard/{DASHBOARD_NAME}/badge/{BADGE_NAME}',
json={})

self.assertEqual(response.status_code, HTTPStatus.BAD_REQUEST)

def test_badge_with_category(self) -> None:
self.app.config['WHITELIST_BADGES'] = [Badge(badge_name='alpha',
category='table_status')]
response = self.app.test_client().put(f'/dashboard/{DASHBOARD_NAME}/badge/{BADGE_NAME}?category=table_status')
response = self.app.test_client().put(f'/dashboard/{DASHBOARD_NAME}/badge/{BADGE_NAME}?category=table_status',
json={})

self.assertEqual(response.status_code, HTTPStatus.OK)

Expand Down
8 changes: 4 additions & 4 deletions metadata/tests/unit/api/dashboard/test_dashboard_tag_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class TestDashboardTagAPI(DashboardTestCase):

def test_should_update_tag(self) -> None:
response = self.app.test_client().put(f'/dashboard/{ID}/tag/{TAG}')
response = self.app.test_client().put(f'/dashboard/{ID}/tag/{TAG}', json={})

self.assertEqual(response.status_code, HTTPStatus.OK)
self.mock_proxy.add_tag.assert_called_with(id=ID,
Expand All @@ -26,12 +26,12 @@ def test_should_update_tag(self) -> None:
def test_should_fail_to_update_tag_when_table_not_found(self) -> None:
self.mock_proxy.add_tag.side_effect = NotFoundException(message='foo')

response = self.app.test_client().put(f'/dashboard/{ID}/tag/{TAG}')
response = self.app.test_client().put(f'/dashboard/{ID}/tag/{TAG}', json={})

self.assertEqual(response.status_code, HTTPStatus.NOT_FOUND)

def test_should_delete_tag(self) -> None:
response = self.app.test_client().delete(f'/dashboard/{ID}/tag/{TAG}')
response = self.app.test_client().delete(f'/dashboard/{ID}/tag/{TAG}', json={})

self.assertEqual(response.status_code, HTTPStatus.OK)
self.mock_proxy.delete_tag.assert_called_with(id=ID,
Expand All @@ -42,6 +42,6 @@ def test_should_delete_tag(self) -> None:
def test_should_fail_to_delete_tag_when_table_not_found(self) -> None:
self.mock_proxy.delete_tag.side_effect = NotFoundException(message='foo')

response = self.app.test_client().delete(f'/dashboard/{ID}/tag/{TAG}')
response = self.app.test_client().delete(f'/dashboard/{ID}/tag/{TAG}', json={})

self.assertEqual(response.status_code, HTTPStatus.NOT_FOUND)
6 changes: 3 additions & 3 deletions metadata/tests/unit/api/feature/test_feature_badge_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ def tearDown(self) -> None:

def test_block_bad_badge_name(self) -> None:
self.app.config['WHITELIST_BADGES'] = []
response = self.app.test_client().put(f'/feature/{FEATURE_NAME}/badge/{BADGE_NAME}?category=data')
response = self.app.test_client().put(f'/feature/{FEATURE_NAME}/badge/{BADGE_NAME}?category=data', json={})

self.assertEqual(response.status_code, HTTPStatus.NOT_FOUND)

def test_block_badge_missing_category(self) -> None:
self.app.config['WHITELIST_BADGES'] = [Badge(badge_name='pii',
category='data')]
response = self.app.test_client().put(f'/feature/{FEATURE_NAME}/badge/{BADGE_NAME}')
response = self.app.test_client().put(f'/feature/{FEATURE_NAME}/badge/{BADGE_NAME}', json={})

self.assertEqual(response.status_code, HTTPStatus.BAD_REQUEST)

def test_badge_with_category(self) -> None:
self.app.config['WHITELIST_BADGES'] = [Badge(badge_name='pii',
category='data')]
response = self.app.test_client().put(f'/feature/{FEATURE_NAME}/badge/{BADGE_NAME}?category=data')
response = self.app.test_client().put(f'/feature/{FEATURE_NAME}/badge/{BADGE_NAME}?category=data', json={})

self.assertEqual(response.status_code, HTTPStatus.OK)

Expand Down
4 changes: 2 additions & 2 deletions metadata/tests/unit/api/feature/test_feature_lineage_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def tearDown(self) -> None:

def test_should_return_response(self) -> None:
self.mock_proxy.get_lineage.return_value = LINEAGE_RESPONSE
response = self.app.test_client().get(f'/feature/{FEATURE_URI}/lineage')
response = self.app.test_client().get(f'/feature/{FEATURE_URI}/lineage', json={})

self.mock_proxy.get_lineage.assert_called_with(id=FEATURE_URI,
resource_type=ResourceType.Feature,
Expand All @@ -64,6 +64,6 @@ def test_should_return_response(self) -> None:
def test_should_fail_when_feature_doesnt_exist(self) -> None:
self.mock_proxy.get_lineage.side_effect = NotFoundException(message='feature not found')

response = self.app.test_client().get(f'/feature/{FEATURE_URI}/lineage')
response = self.app.test_client().get(f'/feature/{FEATURE_URI}/lineage', json={})

self.assertEqual(response.status_code, HTTPStatus.NOT_FOUND)
8 changes: 4 additions & 4 deletions metadata/tests/unit/api/feature/test_feature_tag_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class TestFeatureTagAPI(FeatureTestCase):

def test_should_update_tag(self) -> None:
response = self.app.test_client().put(f'/feature/{FEATURE_URI}/tag/{TAG}')
response = self.app.test_client().put(f'/feature/{FEATURE_URI}/tag/{TAG}', json={})

self.assertEqual(response.status_code, HTTPStatus.OK)
self.mock_proxy.add_tag.assert_called_with(id=FEATURE_URI,
Expand All @@ -26,12 +26,12 @@ def test_should_update_tag(self) -> None:
def test_should_fail_to_update_tag_when_feature_not_found(self) -> None:
self.mock_proxy.add_tag.side_effect = NotFoundException(message='cannot find feature')

response = self.app.test_client().put(f'/feature/{FEATURE_URI}/tag/{TAG}')
response = self.app.test_client().put(f'/feature/{FEATURE_URI}/tag/{TAG}', json={})

self.assertEqual(response.status_code, HTTPStatus.NOT_FOUND)

def test_should_delete_tag(self) -> None:
response = self.app.test_client().delete(f'/feature/{FEATURE_URI}/tag/{TAG}')
response = self.app.test_client().delete(f'/feature/{FEATURE_URI}/tag/{TAG}', json={})

self.assertEqual(response.status_code, HTTPStatus.OK)
self.mock_proxy.delete_tag.assert_called_with(id=FEATURE_URI,
Expand All @@ -42,6 +42,6 @@ def test_should_delete_tag(self) -> None:
def test_should_fail_to_delete_tag_when_feature_not_found(self) -> None:
self.mock_proxy.delete_tag.side_effect = NotFoundException(message='cannot find feature')

response = self.app.test_client().delete(f'/feature/{FEATURE_URI}/tag/{TAG}')
response = self.app.test_client().delete(f'/feature/{FEATURE_URI}/tag/{TAG}', json={})

self.assertEqual(response.status_code, HTTPStatus.NOT_FOUND)
Loading

0 comments on commit 125b04f

Please sign in to comment.