11
.github/workflows/build-test.yml
vendored
11
.github/workflows/build-test.yml
vendored
@ -49,4 +49,15 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
poetry run pytest
|
poetry run pytest
|
||||||
|
env:
|
||||||
|
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
|
||||||
|
|
||||||
|
- name: Upload coverage to Codecov
|
||||||
|
uses: codecov/codecov-action@v2
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
fail_ci_if_error: true
|
||||||
|
flags: unittests
|
||||||
|
files: ${{ github.workspace }}/coverage.txt
|
||||||
|
verbose: true
|
||||||
|
|
||||||
|
@ -46,3 +46,13 @@ class AuthenticatedClient(Client):
|
|||||||
def get_headers(self) -> Dict[str, str]:
|
def get_headers(self) -> Dict[str, str]:
|
||||||
"""Get headers to be used in authenticated endpoints"""
|
"""Get headers to be used in authenticated endpoints"""
|
||||||
return {"Authorization": f"Bearer {self.token}", **self.headers}
|
return {"Authorization": f"Bearer {self.token}", **self.headers}
|
||||||
|
|
||||||
|
@attr.s(auto_attribs=True)
|
||||||
|
class AuthenticatedClientFromEnv(Client):
|
||||||
|
"""A Client which has been authenticated for use on secured endpoints that uses the KITTYCAD_API_TOKEN environment variable for the authentication token."""
|
||||||
|
|
||||||
|
token: str = attr.ib(default=os.getenv('KITTYCAD_API_TOKEN'))
|
||||||
|
|
||||||
|
def get_headers(self) -> Dict[str, str]:
|
||||||
|
"""Get headers to be used in authenticated endpoints"""
|
||||||
|
return {"Authorization": f"Bearer {self.token}", **self.headers}
|
||||||
|
Reference in New Issue
Block a user