Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests and new functional tests #66

Merged
merged 8 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Unit tests
on:
push:
pull_request:

jobs:
run-unit-tests:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up python
uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r test-requirements.txt

- name: Run unit tests
run: |
pytest tests/unit -v --cov=acct_mgt --cov-report=term
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@ oc adm policy add-cluster-role-to-user cluster-admin developer"
oc login -u developer
docker login -u developer -p developer 172.30.1.1:5000

## Running the unit tests

Before running the unit tests, make sure you have installed all the
test dependencies defined in `test-requirements.txt`.

To run the unit tests and produce a coverage report:

```
pytest tests/unit
```

This will place a coverage report in `htmlcov/index.html`.

## Running the service locally

You will need to make sure you are authenticated to OpenShift (when
Expand Down
2 changes: 2 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This file is necessary for pytest to find the modules we're trying
# to test.
5 changes: 3 additions & 2 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pylint
pytest
pytest_check
pytest-check
pytest-coverage
requests
pylint
Empty file added tests/__init__.py
Empty file.
197 changes: 0 additions & 197 deletions tests/amt_helper.py

This file was deleted.

107 changes: 0 additions & 107 deletions tests/amt_project_test.py

This file was deleted.

Loading