From c2dc33f7fcfef6e8f9f243e59f6904486bc595f8 Mon Sep 17 00:00:00 2001 From: Cory Levine Date: Wed, 6 Oct 2021 16:23:33 -0400 Subject: [PATCH 1/3] Reflect v1.7.0 breaking case change in CHANGELOG.md This commit reflects the change made in #205 in the CHANGELOG. --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de9be952..1b88b682 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -109,6 +109,9 @@ _New models:_ * ProfileMappingSource * ThreatInsightConfiguration +### Breaking changes +Custom attributes, set on instances of the `UserProfile` model, will now no longer be automatically converted to lower camel case. + ## v1.6.0 - Update SDK according to openapi spec v2.3.0. - Fix custom user attributes. From e40d5cfb6413813f384c6479826608250c8adce2 Mon Sep 17 00:00:00 2001 From: Serhii Buniak Date: Mon, 18 Oct 2021 18:50:24 +0300 Subject: [PATCH 2/3] Verify idp.type is string --- tests/integration/test_identity_providers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/test_identity_providers.py b/tests/integration/test_identity_providers.py index 9980758d..dc587196 100644 --- a/tests/integration/test_identity_providers.py +++ b/tests/integration/test_identity_providers.py @@ -114,6 +114,7 @@ async def test_add_get_generic_idp(self, fs): assert isinstance(retrieved_idp, models.IdentityProvider) assert retrieved_idp.name == idp_model.name assert retrieved_idp.type == idp_model.type + assert isinstance(retrieved_idp.type, str) assert retrieved_idp.status == "ACTIVE" prot_endp = retrieved_idp.protocol.endpoints assert prot_endp.authorization.url == ISSUER_URL + "/authorize" From 691e18f2814d15241671cc569441ec3ad36cad12 Mon Sep 17 00:00:00 2001 From: Serhii Buniak <73126645+serhiibuniak-okta@users.noreply.github.com> Date: Tue, 16 Nov 2021 17:19:44 +0200 Subject: [PATCH 3/3] Create python-package.yml, Setup GH actions * Add python 3.10-dev to Travis config * Run only integration tests with GH actions --- .github/workflows/python-package.yml | 40 ++++++++++++++++++++++++++++ .travis.yml | 7 ++--- setup.py | 1 + tests/unit/test_client.py | 13 ++++++--- 4 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/python-package.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 00000000..5ccda814 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,40 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python package + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 okta/ --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 okta/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest tests/integration diff --git a/.travis.yml b/.travis.yml index 55b4ea11..c0191df4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ python: - "3.7" - "3.8" - "3.9" + - "3.10-dev" install: - pip install -U -r requirements.txt @@ -17,15 +18,15 @@ jobs: - stage: test python: 3.8 name: "Unit Tests" - script: + script: - echo "Running unit tests..." - pytest tests/unit/ name: "Integration Tests" - script: + script: - echo "Running integration tests..." - pytest tests/integration/ - stage: code_style_test name: "Flake8 Check" - script: + script: - echo "Code Style check..." - "flake8 --extend-ignore=E501 okta/" diff --git a/setup.py b/setup.py index b7a7ab16..7b366fc7 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,7 @@ def get_version(): "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "License :: OSI Approved :: Apache Software License", "Topic :: Software Development :: Libraries :: Python Modules", ], diff --git a/tests/unit/test_client.py b/tests/unit/test_client.py index bd0e6845..f33b1f0b 100644 --- a/tests/unit/test_client.py +++ b/tests/unit/test_client.py @@ -3,7 +3,6 @@ import logging from aiohttp.client_reqrep import ConnectionKey from ssl import SSLCertVerificationError - from okta.client import Client as OktaClient import pytest from okta.constants import FINDING_OKTA_DOMAIN @@ -612,7 +611,11 @@ def test_constructor_invalid_port_number(port): def test_constructor_custom_http_client_impl(): class CustomHTTPClient(HTTPClient): pass - config = {'httpClient': CustomHTTPClient} + org_url = "https://test.okta.com" + token = "TOKEN" + config = {'orgUrl': org_url, + 'token': token, + 'httpClient': CustomHTTPClient} client = OktaClient(config) assert isinstance(client._request_executor._http_client, CustomHTTPClient) @@ -620,7 +623,11 @@ class CustomHTTPClient(HTTPClient): def test_constructor_client_logging(): logger = logging.getLogger('okta-sdk-python') assert logger.disabled - config = {'logging': {"enabled": True, "logLevel": logging.DEBUG}} + org_url = "https://test.okta.com" + token = "TOKEN" + config = {'orgUrl': org_url, + 'token': token, + 'logging': {"enabled": True, "logLevel": logging.DEBUG}} client = OktaClient(config) assert not logger.disabled assert logger.level == logging.DEBUG