After getting Harbor source code (git clone https://github.com/goharbor/harbor.git), Harbor E2E API test scripts can be found in tests/apitests/python directory.
Before scripting, please make sure swagger client has been made by "make swagger_client", then archive "harborclient" will be made
We use $HARBORCLIENT_PATH represent the path of "harborclient" you've made by "make swagger_client".
Deploy Harbor instance for testing, and we will use $HARBOR_URL to represent the deployed Harbor in this document.
Harbor E2E API test scripts will import python library under archive "harborclient", please set OS environment variant for Harbor E2E API test scripts:
1.`export HARBOR_HOST=$HARBOR_URL`
2.`export SWAGGER_CLIENT_PATH=$HARBORCLIENT_PATH`
Until now, we have all preparation work done.
**Scripting**
As you can see, we will use python library made by "make swagger_client", in this library, we have all API functions and models, but for more convenience we encapsulate one more level in archive "library", so the script structure is as bellow:
-library/
-test_project_level_policy_content_trust.py
-test_project_quota.py
-test_retention.py
-...
You can add both library code and script code, since not all APIs have been encapsulated.