-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #411 from openedx/knguyen2/ent-8416
feat: update enterprise_contains_learner return value
- Loading branch information
Showing
8 changed files
with
106 additions
and
73 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,8 @@ | |
|
||
from enterprise_access.apps.api_client.lms_client import LmsApiClient | ||
from enterprise_access.apps.api_client.tests.test_utils import MockResponse | ||
from test_utils import TEST_ENTERPRISE_UUID, TEST_USER_ID, TEST_USER_RECORD | ||
|
||
TEST_ENTERPRISE_UUID = uuid4() | ||
TEST_USER_EMAILS = [ | ||
'[email protected]', | ||
'[email protected]', | ||
|
@@ -168,32 +168,22 @@ def test_unlink_users_from_enterprise(self, mock_oauth_client): | |
|
||
@mock.patch('requests.Response.json') | ||
@mock.patch('enterprise_access.apps.api_client.base_oauth.OAuthAPIClient') | ||
def test_enterprise_contains_learner(self, mock_oauth_client, mock_json): | ||
def test_get_enterprise_user(self, mock_oauth_client, mock_json): | ||
""" | ||
Verify enterprise_contains_learner works as expected. | ||
Verify get_enterprise_user works as expected. | ||
""" | ||
mock_enterprise_uuid = str(uuid4()) | ||
user_id = 1234 | ||
mock_oauth_client.return_value.get.return_value = requests.Response() | ||
mock_oauth_client.return_value.get.return_value.status_code = 200 | ||
|
||
mock_json.return_value = { | ||
'results': [ | ||
{ | ||
'enterprise_customer': { | ||
'uuid': mock_enterprise_uuid | ||
}, | ||
'user': { | ||
'id': user_id | ||
} | ||
} | ||
TEST_USER_RECORD | ||
] | ||
} | ||
|
||
query_params = {'enterprise_customer_uuid': mock_enterprise_uuid, 'user_ids': user_id} | ||
query_params = {'enterprise_customer_uuid': str(TEST_ENTERPRISE_UUID), 'user_ids': TEST_USER_ID} | ||
client = LmsApiClient() | ||
enterprise_contains_learner = client.enterprise_contains_learner(mock_enterprise_uuid, user_id) | ||
assert enterprise_contains_learner | ||
get_enterprise_user = client.get_enterprise_user(str(TEST_ENTERPRISE_UUID), TEST_USER_ID) | ||
assert get_enterprise_user == TEST_USER_RECORD | ||
|
||
mock_oauth_client.return_value.get.assert_called_with( | ||
'http://edx-platform.example.com/enterprise/api/v1/enterprise-learner/', | ||
|
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.