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

added new test suite to workflow resolves #67 #68

Merged
merged 13 commits into from
Dec 11, 2023
22 changes: 16 additions & 6 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ on:
push:
branches:
- main
- tidyup
- coverage
pull_request:
branches:
- main
- tidyup
- coverage

jobs:
install:
Expand All @@ -34,18 +34,28 @@ jobs:
cd ScheduleBuilder
pip install -r requirements.txt

- name: Run Tests with Coverage
- name: Run Account Tests with Coverage
env:
CAL_ID: c_6ed17073345c64d5b392f5a8ef7b4a62938f12c8fc5fecfa4b7256ef88acad28@group.calendar.google.com
run: |
cd ScheduleBuilder/google_calendar
pytest --cov=./ --cov-report=xml test.py
cd ScheduleBuilder
python manage.py makemigrations
python manage.py migrate
cd account
pytest --cov=./ regtests.py


- name: Create Coverage Report
run: |
cd ScheduleBuilder
coverage combine account/.coverage
coverage xml -o coverage.xml

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./ScheduleBuilder/google_calendar/coverage.xml
files: ./ScheduleBuilder/coverage.xml
fail_ci_if_error: true
15 changes: 9 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
push:
branches:
- main
- tidyup
- coverage
pull_request:
branches:
- main
- tidyup
- coverage

jobs:
install:
Expand All @@ -34,10 +34,13 @@ jobs:
run: |
cd ScheduleBuilder
pip install -r requirements.txt

- name: Run Tests
- name: Run Account Tests
env:
CAL_ID: c_6ed17073345c64d5b392f5a8ef7b4a62938f12c8fc5fecfa4b7256ef88acad28@group.calendar.google.com
run: |
cd ScheduleBuilder/google_calendar
pytest test.py
cd ScheduleBuilder
python manage.py makemigrations
python manage.py migrate
cd account
pytest regtests.py
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,8 @@ Then go to the browser and enter the url **http://127.0.0.1:8000/**
- Remove friends
- Add friends to events
* PyTest
- Implementated unit tests for google calendar
- Implementated unit tests for google calendar and accounts
* CI/CD
- Django build badge
- Django tests badge
- Test coverage badge
2 changes: 1 addition & 1 deletion ScheduleBuilder/account/regtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ def test_create_user_no_username_sad():
username='', # Empty username should raise ValueError
password='testpassword',
)
print(f"Exception message: {e}")
print(f"Exception message: {e}")