[Testing] Fix docker build (#4109)

* Test fix for ongoing CI issues

(cherry picked from commit 3bf5492cb6)

* Run docker test on PR (temporarily)

* Add token to unit testing env

* Add github token to env file

* Fix for github token

* Ignore blank tokens

* Don't run on PR
This commit is contained in:
Oliver 2022-12-26 23:27:12 +11:00 committed by GitHub
parent 28ec6b9d18
commit 95dc78a61f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -21,6 +21,10 @@ on:
branches:
- 'master'
# pull_request:
# branches:
# - 'master'
jobs:
# Build the docker image
@ -70,6 +74,7 @@ jobs:
test -f data/secret_key.txt
- name: Run Unit Tests
run: |
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> docker.dev.env
docker-compose run inventree-dev-server invoke test --disable-pty
docker-compose down
- name: Set up QEMU

View File

@ -537,8 +537,11 @@ class APICallMixin:
headers = {'Content-Type': 'application/json'}
if getattr(self, 'API_TOKEN_SETTING'):
token = self.get_setting(self.API_TOKEN_SETTING)
headers[self.API_TOKEN] = token
headers['Authorization'] = f"{self.API_TOKEN} {token}"
if token:
headers[self.API_TOKEN] = token
headers['Authorization'] = f"{self.API_TOKEN} {token}"
return headers
def api_build_url_args(self, arguments: dict) -> str: