File tree Expand file tree Collapse file tree
archivist_samples/testing Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828 - name : Run integrity checks
2929 run : |
3030 export PYTHONPATH=samples:${PYTHONPATH}
31+ scripts/version.sh
3132 pycodestyle --format=pylint archivist_samples
3233 python3 -m pylint archivist_samples
3334 black archivist_samples
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ specify the archivist endpoint:
3333export TEST_ARCHIVIST=" https://app.datatrails.ai"
3434export TEST_AUTHTOKEN_FILENAME=credentials/.auth_token
3535export TEST_NAMESPACE=" unique label"
36+ export TEST_PARTNER_ID=" acmecorp"
3637export TEST_VERBOSE=-v
3738```
3839
@@ -44,6 +45,7 @@ Windows using Powershell - at the command prompt set values for environment vari
4445$Env :TEST_ARCHIVIST=" https://app.datatrails.ai"
4546$Env :TEST_AUTHTOKEN_FILENAME = ' <path of token location>'
4647$Env :TEST_NAMESPACE = Get-Date -UFormat %s
48+ $Env :TEST_PARTNER_ID = ' acmecorp'
4749$Env :TEST_VERBOSE = ' -v'
4850```
4951
@@ -70,7 +72,7 @@ All examples use a common set of arguments:
7072
7173``` bash
7274export AUTH=" -u $TEST_ARCHIVIST -t $TEST_AUTHTOKEN_FILENAME $TEST_VERBOSE "
73- export ARGS=" $AUTH --namespace $TEST_NAMESPACE "
75+ export ARGS=" $AUTH --namespace $TEST_NAMESPACE --partner_id= $TEST_PARTNER_ID "
7476```
7577
7678### Door Entry Control
Original file line number Diff line number Diff line change 7373
7474 wheel :
7575 desc : Builds python wheel package
76- deps : [about, clean ]
76+ deps : [about]
7777 cmds :
7878 - ./scripts/api.sh ./scripts/wheel.sh
Original file line number Diff line number Diff line change 1616from archivist .archivist import Archivist
1717from archivist .logger import set_logger
1818
19+ from ..about import __version__ as VERSION
20+ from .constants import USER_AGENT_PREFIX
21+
1922LOGGER = logging .getLogger (__name__ )
2023
2124
@@ -81,6 +84,15 @@ def common_parser(description):
8184 required = True ,
8285 help = "FILE containing API authentication token" ,
8386 )
87+ parser .add_argument (
88+ "-p" ,
89+ "--partner_id" ,
90+ type = str ,
91+ dest = "partner_id" ,
92+ action = "store" ,
93+ default = "" ,
94+ help = "partner id" ,
95+ )
8496
8597 return parser
8698
@@ -98,7 +110,12 @@ def endpoint(args):
98110 with open (args .auth_token_file , mode = "r" , encoding = "utf-8" ) as tokenfile :
99111 authtoken = tokenfile .read ().strip ()
100112
101- arch = Archivist (args .url , authtoken )
113+ arch = Archivist (
114+ args .url ,
115+ authtoken ,
116+ partner_id = args .partner_id ,
117+ user_agent = f"{ USER_AGENT_PREFIX } { VERSION } " ,
118+ )
102119
103120 if arch is None :
104121 LOGGER .error ("Critical error. Aborting." )
Original file line number Diff line number Diff line change 1+ """Constants
2+ """
3+
4+ USER_AGENT_PREFIX = "samples/"
Original file line number Diff line number Diff line change @@ -7,4 +7,4 @@ pyyaml~=6.0.1
77# the following lines. Also do similar in the Dockerfile.
88# That way one can test an unreleased version of github datatrails-samples.
99# NB dont forget to uncomment before merging !!
10- datatrails-archivist == 0.31.1
10+ datatrails-archivist == 0.31.2
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ docker run \
1515 -e TEST_ARCHIVIST \
1616 -e TEST_AUTHTOKEN_FILENAME \
1717 -e TEST_NAMESPACE \
18+ -e TEST_PARTNER_ID \
1819 -e TEST_SELECTOR \
1920 -e TEST_VERBOSE \
2021 -e GITHUB_REF \
Original file line number Diff line number Diff line change 77# Populate the credentials directory with auth token.
88# The auth token must be for a particular tenant identity.
99#
10+ rm -rf samples-venv
1011python3 -m venv samples-venv
1112source samples-venv/bin/activate
12- python3 -m pip install -q --force-reinstall dist/datatrails_samples-* .whl
13+ function finalise {
14+ deactivate
15+ rm -rf samples-venv
16+ }
17+ trap finalise EXIT
1318
1419# do everything in sub directory to ensure that wheel is used and not local code.
15- export TEST_AUTHTOKEN_FILENAME=../${TEST_AUTHTOKEN_FILENAME}
16- (cd samples-venv && ../scripts/samples.sh functests)
20+ (export TEST_AUTHTOKEN_FILENAME=../${TEST_AUTHTOKEN_FILENAME} \
21+ && cd samples-venv \
22+ && python3 -m pip install -q ../dist/datatrails_samples-* .whl \
23+ && ../scripts/samples.sh functests)
1724
18- deactivate
19- rm -rf samples-venv
2025
2126
Original file line number Diff line number Diff line change @@ -100,6 +100,11 @@ else
100100 echo " No NAMESPACE specified - may share assets etc with someone else on same URL"
101101fi
102102
103+ if [ -n " $TEST_PARTNER_ID " ]
104+ then
105+ ARGS=" $ARGS --partner_id ${TEST_PARTNER_ID} "
106+ fi
107+
103108# emit command if executing tests against the docker image or the installed wheel
104109command () {
105110 if [ " ${TASK} " == " samples" ]
You can’t perform that action at this time.
0 commit comments