Skip to content

Commit

Permalink
First test
Browse files Browse the repository at this point in the history
  • Loading branch information
msetina committed Apr 4, 2024
1 parent f03418d commit e542f5f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .github/workflows/build-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ jobs:
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install build tools
run: pip install --upgrade swig build setuptools pip wheel
run: pip install --upgrade swig softhsm2 build setuptools pip wheel
- name: Prep softhsm
run: |
sudo chmod -R a+rx /etc/softhsm
sudo chmod a+r /etc/softhsm/softhsm2.conf
sudo chown -R $(whoami) /var/lib/softhsm
softhsm2-util --init-token --slot 0 --label "A token" --pin 1234 --so-pin 123456
- name: Build release artifacts
run: python -m build
- name: Record release artifact hashes
Expand Down Expand Up @@ -65,6 +71,14 @@ jobs:
WHEEL=(dist/*.whl)
REQ="${WHEEL[0]}[testing]"
python -m pip install $REQ
- name: Install softhsm
run: pip install --upgrade softhsm2
- name: Prep softhsm
run: |
sudo chmod -R a+rx /etc/softhsm
sudo chmod a+r /etc/softhsm/softhsm2.conf
sudo chown -R $(whoami) /var/lib/softhsm
softhsm2-util --init-token --slot 0 --label "A token" --pin 1234 --so-pin 123456
- name: Test with pytest
run: python -m pytest --cov=./ --cov-report=xml:python-${{ matrix.python-version }}-coverage.xml
env:
Expand Down
13 changes: 13 additions & 0 deletions cryptography_keys_tests/test_base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
_pkcs11lib = "/usr/lib/softhsm/libsofthsm2.so"


class TestBasic:

def test_labels(self):
from pkcs11_cryptography_keys import list_token_labels

cnt = 0
for label in list_token_labels(_pkcs11lib):
print(label)
cnt = cnt + 1
assert cnt == 1

0 comments on commit e542f5f

Please sign in to comment.