-
Notifications
You must be signed in to change notification settings - Fork 13
Add integration tests for knowledgebase and filestorage #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,125 @@ | ||
| import os | ||
| import pytest | ||
| from merge import Merge | ||
| from merge.resources.filestorage.types.permission import Permission | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def client(): | ||
| account_token = os.environ["SDK_TESTING_FILE_STORAGE_ACCOUNT_TOKEN"] | ||
| api_key = os.environ["SDK_TESTING_KEY"] | ||
|
|
||
| return Merge( | ||
| account_token=account_token, | ||
| api_key=api_key, | ||
| ) | ||
|
|
||
| def test_files_list(client): | ||
| response = client.filestorage.files.list() | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
|
|
||
| def test_files_list_permissions(client): | ||
|
|
||
| response = client.filestorage.files.list(page_size=1) | ||
| assert response.results | ||
| file = response.results[0] | ||
| first_permission = file.permissions[0] | ||
|
|
||
| assert isinstance(first_permission, Permission), type(first_permission) | ||
|
|
||
| def test_files_retrieve(client): | ||
| files_response = client.filestorage.files.list(page_size=1) | ||
|
|
||
| assert files_response.results, "No files available to test retrieve" | ||
|
|
||
| file_id = files_response.results[0].id | ||
| file = client.filestorage.files.retrieve(id=file_id) | ||
|
|
||
| assert file is not None | ||
| assert file.id == file_id | ||
|
|
||
| def test_sync_status_list(client): | ||
| response = client.filestorage.sync_status.list() | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_account_details_retrieve(client): | ||
| account_details = client.filestorage.account_details.retrieve() | ||
| assert account_details is not None | ||
| assert hasattr(account_details, 'id') | ||
|
|
||
| def test_drives_list(client): | ||
| response = client.filestorage.drives.list() | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_drives_retrieve(client): | ||
| drives_response = client.filestorage.drives.list(page_size=1) | ||
|
|
||
| assert drives_response.results, "No drives available to test retrieve" | ||
| drive_id = drives_response.results[0].id | ||
| drive = client.filestorage.drives.retrieve(id=drive_id) | ||
| assert drive is not None | ||
| assert drive.id == drive_id | ||
|
|
||
| def test_folders_list(client): | ||
| response = client.filestorage.folders.list() | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_users_list(client): | ||
| response = client.filestorage.users.list() | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_users_retrieve(client): | ||
| users_response = client.filestorage.users.list(page_size=1) | ||
|
|
||
| assert users_response.results, "No users available to test retrieve" | ||
|
|
||
| user_id = users_response.results[0].id | ||
| user = client.filestorage.users.retrieve(id=user_id) | ||
|
|
||
| assert user is not None | ||
| assert user.id == user_id | ||
|
|
||
| def test_groups_list(client): | ||
| response = client.filestorage.groups.list() | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_audit_trail_list(client): | ||
| response = client.filestorage.audit_trail.list() | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_available_actions_retrieve(client): | ||
| available_actions = client.filestorage.available_actions.retrieve() | ||
|
|
||
| assert available_actions is not None | ||
|
|
||
| def test_linked_accounts_list(client): | ||
| response = client.filestorage.linked_accounts.list() | ||
|
|
||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_scopes_default_scopes_retrieve(client): | ||
| response = client.filestorage.scopes.default_scopes_retrieve() | ||
|
|
||
| assert response is not None | ||
|
|
||
| def test_scopes_linked_account_scopes_retrieve(client): | ||
| response = client.filestorage.scopes.linked_account_scopes_retrieve() | ||
|
|
||
| assert response is not None |
This file contains hidden or 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,177 @@ | ||
| import os | ||
| import pytest | ||
| from merge import Merge | ||
| from merge.resources.knowledgebase.resources.articles.types.articles_list_request_expand import ArticlesListRequestExpand | ||
| from merge.resources.knowledgebase.resources.articles.types.articles_retrieve_request_expand import ArticlesRetrieveRequestExpand | ||
| from merge.resources.knowledgebase.resources.containers.types.containers_list_request_expand import ContainersListRequestExpand | ||
| from merge.resources.knowledgebase.resources.containers.types.containers_retrieve_request_expand import ContainersRetrieveRequestExpand | ||
| from merge.resources.knowledgebase.resources.groups.types.groups_list_request_expand import GroupsListRequestExpand | ||
| from merge.resources.knowledgebase.resources.groups.types.groups_retrieve_request_expand import GroupsRetrieveRequestExpand | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def client(): | ||
| account_token = os.environ["SDK_TESTING_KNOWLEDGEBASE_ACCOUNT_TOKEN"] | ||
| api_key = os.environ["SDK_TESTING_KEY"] | ||
|
|
||
| return Merge( | ||
| account_token=account_token, | ||
| api_key=api_key, | ||
| ) | ||
|
|
||
| def test_articles_list(client): | ||
| response = client.knowledgebase.articles.list() | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_articles_list_with_expand_author(client): | ||
| response = client.knowledgebase.articles.list(expand=ArticlesListRequestExpand.AUTHOR) | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_articles_list_with_expand_attachments(client): | ||
| response = client.knowledgebase.articles.list(expand=ArticlesListRequestExpand.ATTACHMENTS) | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_articles_list_with_expand_permissions(client): | ||
| response = client.knowledgebase.articles.list(expand=ArticlesListRequestExpand.PERMISSIONS) | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_attachments_list(client): | ||
| response = client.knowledgebase.attachments.list() | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_attachments_retrieve(client): | ||
| attachments_response = client.knowledgebase.attachments.list(page_size=1) | ||
|
|
||
| if attachments_response.results: | ||
| attachment_id = attachments_response.results[0].id | ||
| attachment = client.knowledgebase.attachments.retrieve(id=attachment_id) | ||
| assert attachment is not None | ||
| assert attachment.id == attachment_id | ||
|
|
||
| def test_containers_list(client): | ||
| response = client.knowledgebase.containers.list() | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_containers_retrieve(client): | ||
| containers_response = client.knowledgebase.containers.list(page_size=1) | ||
|
|
||
| if containers_response.results: | ||
| container_id = containers_response.results[0].id | ||
| container = client.knowledgebase.containers.retrieve(id=container_id) | ||
| assert container is not None | ||
| assert container.id == container_id | ||
|
|
||
| def test_containers_list_with_expand_permissions(client): | ||
| response = client.knowledgebase.containers.list(expand=ContainersListRequestExpand.PERMISSIONS) | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_containers_list_with_expand_parent_container(client): | ||
| response = client.knowledgebase.containers.list(expand=ContainersListRequestExpand.PARENT_CONTAINER) | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_containers_retrieve_with_expand_permissions(client): | ||
| containers_response = client.knowledgebase.containers.list(page_size=1) | ||
|
|
||
| if containers_response.results: | ||
| container_id = containers_response.results[0].id | ||
| container = client.knowledgebase.containers.retrieve(id=container_id, expand=ContainersRetrieveRequestExpand.PERMISSIONS) | ||
| assert container is not None | ||
| assert container.id == container_id | ||
|
|
||
| def test_containers_retrieve_with_expand_parent_container(client): | ||
| containers_response = client.knowledgebase.containers.list(page_size=1) | ||
|
|
||
| if containers_response.results: | ||
| container_id = containers_response.results[0].id | ||
| container = client.knowledgebase.containers.retrieve(id=container_id, expand=ContainersRetrieveRequestExpand.PARENT_CONTAINER) | ||
| assert container is not None | ||
| assert container.id == container_id | ||
|
|
||
| def test_sync_status_list(client): | ||
| response = client.knowledgebase.sync_status.list() | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_account_details_retrieve(client): | ||
| account_details = client.knowledgebase.account_details.retrieve() | ||
| assert account_details is not None | ||
| assert hasattr(account_details, 'id') | ||
|
|
||
| def test_users_list(client): | ||
| response = client.knowledgebase.users.list() | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_users_retrieve(client): | ||
| users_response = client.knowledgebase.users.list(page_size=1) | ||
|
|
||
| if users_response.results: | ||
| user_id = users_response.results[0].id | ||
| user = client.knowledgebase.users.retrieve(id=user_id) | ||
|
|
||
| assert user is not None | ||
| assert user.id == user_id | ||
|
|
||
| def test_groups_list(client): | ||
| response = client.knowledgebase.groups.list() | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_groups_list_with_expand_users(client): | ||
| response = client.knowledgebase.groups.list(expand=GroupsListRequestExpand.USERS) | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_groups_list_with_expand_parent_group(client): | ||
| response = client.knowledgebase.groups.list(expand=GroupsListRequestExpand.PARENT_GROUP) | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_audit_trail_list(client): | ||
| response = client.knowledgebase.audit_trail.list() | ||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_available_actions_retrieve(client): | ||
| available_actions = client.knowledgebase.available_actions.retrieve() | ||
|
|
||
| assert available_actions is not None | ||
|
|
||
| def test_linked_accounts_list(client): | ||
| response = client.knowledgebase.linked_accounts.list() | ||
|
|
||
| assert response is not None | ||
| assert hasattr(response, 'results') | ||
| assert isinstance(response.results, list) | ||
|
|
||
| def test_scopes_default_scopes_retrieve(client): | ||
| response = client.knowledgebase.scopes.default_scopes_retrieve() | ||
|
|
||
| assert response is not None | ||
|
|
||
| def test_scopes_linked_account_scopes_retrieve(client): | ||
| response = client.knowledgebase.scopes.linked_account_scopes_retrieve() | ||
|
|
||
| assert response is not None |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we not want to ingore all tests?