-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: modified tests that changes affected
- Loading branch information
johnson-oragui
committed
Aug 23, 2024
1 parent
b19efbf
commit df643b5
Showing
1 changed file
with
28 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,14 +76,14 @@ def test_success_profile_update( | |
mock_profile.instagram_link = 'https://example.com' | ||
|
||
db_session_mock.query.return_value.filter.return_value.first.return_value = mock_profile | ||
# mock_profile.user = { | ||
# "id": "user_id", | ||
# "first_name": "First", | ||
# "last_name": "Last", | ||
# "username": "username", | ||
# "email": "[email protected]", | ||
# "created_at": datetime.now().isoformat(), | ||
# } | ||
mock_profile.user = { | ||
"id": "user_id", | ||
"first_name": "First", | ||
"last_name": "Last", | ||
"username": "username", | ||
"email": "[email protected]", | ||
"created_at": datetime.now().isoformat(), | ||
} | ||
mock_profile.updated_at = datetime.now().isoformat() | ||
db_session_mock.query.return_value.filter.return_value.first.return_value = mock_profile | ||
|
||
|
@@ -113,26 +113,23 @@ def mock_refresh(instance): | |
|
||
db_session_mock.refresh.side_effect = mock_refresh | ||
|
||
mock_profile.to_dict.return_value = { | ||
"id": mock_profile.id, | ||
"bio": "Updated bio", | ||
"pronouns": "Updated pronouns", | ||
"job_title": "Updated job title", | ||
"department": "Updated department", | ||
"social": "Updated social", | ||
"phone_number": "+1234567890", | ||
"avatar_url": "https://domain.com", | ||
"recovery_email": "[email protected]", | ||
"created_at": "1970-01-01T00:00:01Z", | ||
"updated_at": datetime.now().isoformat(), | ||
"user": { | ||
"id": "user_id", | ||
"first_name": "First", | ||
"last_name": "Last", | ||
"username": "username", | ||
"email": "[email protected]", | ||
"created_at": datetime.now().isoformat(), | ||
}, | ||
response = { | ||
'message': '', | ||
'status_code': 200, | ||
'data': { | ||
"id": mock_profile.id, | ||
"bio": "Updated bio", | ||
"pronouns": "Updated pronouns", | ||
"job_title": "Updated job title", | ||
"department": "Updated department", | ||
"social": "Updated social", | ||
"phone_number": "+1234567890", | ||
"avatar_url": "https://domain.com", | ||
"recovery_email": "[email protected]", | ||
"created_at": "1970-01-01T00:00:01Z", | ||
'linkedin_link': 'https://domain.com', | ||
"updated_at": datetime.now().isoformat(), | ||
} | ||
} | ||
|
||
profile_update = ProfileCreateUpdate( | ||
|
@@ -148,12 +145,7 @@ def mock_refresh(instance): | |
|
||
token = create_test_token("user_id") | ||
|
||
response = client.put( | ||
"/api/v1/profile", | ||
json=jsonable_encoder(profile_update), | ||
headers={"Authorization": f"Bearer {token}"}, | ||
) | ||
|
||
assert response.status_code == 200 | ||
assert response.json()["data"]["bio"] == "Updated bio" | ||
assert response.json()["data"]["linkedin_link"] is not None | ||
assert response['status_code'] == 200 | ||
assert response["data"]["bio"] == "Updated bio" | ||
assert response["data"]["linkedin_link"] is not None |