-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
657 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import json, os | ||
from appointment.database.models import ExternalConnectionType | ||
from defines import auth_headers, TEST_USER_ID | ||
|
||
|
||
class TestAccount: | ||
def test_account_get_external_connections(self, with_client, make_external_connections): | ||
# add a couple of external connections to our test user | ||
username = 'username' | ||
type_id = json.dumps(['url', username]) | ||
zoom_ec = make_external_connections(TEST_USER_ID, type=ExternalConnectionType.zoom, type_id=type_id) | ||
assert zoom_ec.type_id == type_id | ||
google_ec = make_external_connections(TEST_USER_ID, type=ExternalConnectionType.google, type_id=type_id) | ||
assert google_ec.type_id == type_id | ||
|
||
# now get the list of our external connections and verify | ||
response = with_client.get( | ||
'/account/external-connections', headers=auth_headers | ||
) | ||
|
||
assert response.status_code == 200, response.text | ||
ext_connections = response.json() | ||
zoom_connections = ext_connections.get('zoom', None) | ||
assert len(zoom_connections) == 1 | ||
assert zoom_connections[0]['owner_id'] == TEST_USER_ID | ||
assert zoom_connections[0]['name'] == zoom_ec.name | ||
google_connections = ext_connections.get('google', None) | ||
assert len(google_connections) == 1 | ||
assert google_connections[0]['owner_id'] == TEST_USER_ID | ||
assert google_connections[0]['name'] == google_ec.name | ||
|
||
def test_account_available_emails(self, with_client, make_external_connections): | ||
# currently we have one email available | ||
test_user_email = os.environ.get('TEST_USER_EMAIL') | ||
user_email_list = [ test_user_email ] | ||
|
||
# get available emails and confirm | ||
response = with_client.get( | ||
'/account/available-emails', headers=auth_headers | ||
) | ||
|
||
assert response.status_code == 200, response.text | ||
email_list_ret = response.json() | ||
assert email_list_ret == user_email_list | ||
|
||
# now add another email/name via a google connection | ||
type_id = json.dumps(['url', test_user_email]) | ||
google_ec = make_external_connections(TEST_USER_ID, type=ExternalConnectionType.google, type_id=type_id) | ||
user_email_list.append(google_ec.name) | ||
|
||
# get available emails again and confirm new one was added | ||
response = with_client.get( | ||
'/account/available-emails', headers=auth_headers | ||
) | ||
|
||
assert response.status_code == 200, response.text | ||
email_list_ret = response.json() | ||
assert email_list_ret == user_email_list |
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
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
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
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
Oops, something went wrong.