diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index d03310ef..644baaf8 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -159,13 +159,28 @@ export TEST_CLIENT_SECRET_FILENAME= export TEST_CLIENT_SECRET="ey.....................ab==" task functests ``` -Lastly when running the runner tests one can specify a namespace to isolate instances of assets in differnt +When running the runner tests one can specify a namespace to isolate instances of assets in differnt runs: ```bash export ARCHIVIST_NAMESPACE=${RANDOM} FUNCTEST=execrunner task functests ``` +Additional environment variables: + +For testing sharing via an access policy requires a second auth token: + +```bash +TEST_AUTHTOKEN_FILENAME_2= +``` + +Testing of the client token refresh logic can take 10 to 20 minutes to complete. +To enable this test set: + +```bash +TEST_REFRESH_TOKEN=anything +``` + #### Testing Other Python Versions ##### Python 3.7 (default) diff --git a/functests/execaccess_policies.py b/functests/execaccess_policies.py index b8b5ab7e..617939ab 100644 --- a/functests/execaccess_policies.py +++ b/functests/execaccess_policies.py @@ -4,7 +4,7 @@ from copy import deepcopy from os import getenv -from unittest import TestCase +from unittest import TestCase, skipIf from uuid import uuid4 from archivist.archivist import Archivist @@ -115,6 +115,10 @@ def test_access_policies_count(self): ) +@skipIf( + getenv("TEST_AUTHTOKEN_FILENAME_2") is None, + "cannot run test as TEST_AUTHTOKEN_FILENAME_2 is not set", +) class TestAccessPolicies(TestAccessPoliciesBase): """ Test Archivist AccessPolicies Create method diff --git a/functests/execapplications.py b/functests/execapplications.py index ea41a65f..87343c15 100644 --- a/functests/execapplications.py +++ b/functests/execapplications.py @@ -5,7 +5,7 @@ from json import dumps as json_dumps from os import getenv from time import sleep -from unittest import TestCase +from unittest import TestCase, skipIf from uuid import uuid4 from archivist.archivist import Archivist @@ -136,6 +136,10 @@ def test_applications_list(self): """ Test application list """ + application = self.arch.applications.create( + self.display_name, + CUSTOM_CLAIMS, + ) applications = list(self.arch.applications.list(display_name=self.display_name)) self.assertGreater( len(applications), @@ -193,6 +197,10 @@ def test_appidp_token_404(self): client_secret, ) + @skipIf( + getenv("TEST_REFRESH_TOKEN") is None, + "cannot run test as TEST_REFRESH_TOKEN is not set", + ) def test_archivist_token(self): """ Test archivist with client id/secret diff --git a/scripts/builder.sh b/scripts/builder.sh index 52e24910..65c749c1 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -22,5 +22,6 @@ docker run \ -e TEST_CLIENT_SECRET \ -e TEST_CLIENT_SECRET_FILENAME \ -e TEST_DEBUG \ + -e TEST_REFRESH_TOKEN \ jitsuin-archivist-python-builder \ "$@"