-
Notifications
You must be signed in to change notification settings - Fork 7
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
5 changed files
with
127 additions
and
94 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Run Python Tests | ||
on: [push] | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build | ||
run: | | ||
npm install | ||
npm run generate.python | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
working-directory: ./clients/python | ||
- name: Run tests | ||
run: | | ||
cd ./clients/python | ||
pip install -r requirements.txt -r test-requirements.txt | ||
python -m unittest |
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 |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# coding: utf-8 | ||
|
||
""" | ||
Phrase Strings API Reference | ||
The version of the OpenAPI document: 2.0.0 | ||
Contact: [email protected] | ||
Generated by: https://openapi-generator.tech | ||
""" | ||
|
||
|
||
from __future__ import absolute_import | ||
|
||
import unittest | ||
from unittest.mock import Mock, patch | ||
|
||
|
||
import phrase_api | ||
from phrase_api.api.locales_api import LocalesApi # noqa: E501 | ||
from phrase_api.rest import ApiException | ||
|
||
|
||
class TestLocalesApi(unittest.TestCase): | ||
"""LocalesApi unit test stubs""" | ||
|
||
def setUp(self): | ||
self.configuration = phrase_api.Configuration() | ||
self.configuration.api_key['Authorization'] = 'YOUR_API_KEY' | ||
self.configuration.api_key_prefix['Authorization'] = 'token' | ||
|
||
def tearDown(self): | ||
pass | ||
|
||
def test_account_locales(self): | ||
"""Test case for account_locales | ||
List locales used in account # noqa: E501 | ||
""" | ||
pass | ||
|
||
|
||
|
||
def test_locale_create(self): | ||
"""Test case for locale_create | ||
Create a locale # noqa: E501 | ||
""" | ||
pass | ||
|
||
def test_locale_delete(self): | ||
"""Test case for locale_delete | ||
Delete a locale # noqa: E501 | ||
""" | ||
pass | ||
|
||
def test_locale_download(self): | ||
"""Test case for locale_download | ||
Download a locale # noqa: E501 | ||
""" | ||
pass | ||
|
||
def test_locale_show(self): | ||
"""Test case for locale_show | ||
Get a single locale # noqa: E501 | ||
""" | ||
pass | ||
|
||
def test_locale_update(self): | ||
"""Test case for locale_update | ||
Update a locale # noqa: E501 | ||
""" | ||
pass | ||
|
||
@patch('phrase_api.ApiClient.request') | ||
def test_locales_list(self, mock_get): | ||
"""Test case for locales_list | ||
List locales # noqa: E501 | ||
""" | ||
mock_get.return_value = Mock(ok=True) | ||
mock_get.return_value.data = '[{"id":"locale_id","name":"locale_name","code":"locale_code","default":true,"main":true,"rtl":true,"plural_forms":["plural_forms"]}]' | ||
|
||
project_id = "project_id_example" | ||
with phrase_api.ApiClient(self.configuration) as api_client: | ||
api_instance = phrase_api.api.locales_api.LocalesApi(api_client) | ||
api_response = api_instance.locales_list(project_id) | ||
print(api_response) | ||
|
||
self.assertIsNotNone(api_response) | ||
self.assertEqual(1, len(api_response)) | ||
self.assertIsInstance(api_response[0], phrase_api.models.locale.Locale) | ||
self.assertEqual("locale_id", api_response[0].id) | ||
self.assertEqual("locale_id", api_response[0].id) | ||
self.assertEqual("locale_name", api_response[0].name) | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.