-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
199eceb
commit df945d5
Showing
11 changed files
with
70 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,16 +49,20 @@ jobs: | |
# Disable shallow clones, as recommended by SonarQube for improved analysis and reports | ||
fetch-depth: 0 | ||
|
||
- name: Run apis | ||
- name: Run apis unit test | ||
run: make run-apis-coverage | ||
|
||
- name: List folder | ||
run: ls -la apis/_output/reports | ||
- name: Run crud unit test | ||
run: make run-crud-unit-tests | ||
|
||
- name: Fix code coverage paths | ||
- name: Fix apis code coverage paths | ||
run: | | ||
mkdir apis/reports ; cp apis/_output/reports/coverage.xml apis/reports/coverage_fixed.xml ; sed -i 's/root/\/github\/workspace\/apis/g' apis/reports/coverage_fixed.xml | ||
- name: Fix apis code coverage paths | ||
run: | | ||
mkdir crud/reports ; cp crud/_output/reports/coverage.xml crud/reports/coverage_fixed.xml ; sed -i 's/root/\/github\/workspace\/crud/g' crud/reports/coverage_fixed.xml | ||
- name: Analyze with SonarCloud | ||
|
||
uses: SonarSource/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from endpoints.health import Health | ||
|
||
def test_health(): | ||
health = Health() | ||
response = health.get() | ||
assert response == ({'status': 'ok'}, 200) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from endpoints.products import Products | ||
from pytest import raises | ||
def test_get_products(): | ||
products = Products() | ||
response = products.get() | ||
assert response == ([], 200) | ||
|
||
def test_delete_products_missing_id(): | ||
products = Products() | ||
with raises(TypeError) as excinfo: | ||
products.delete() | ||
assert "missing 1 required positional argument" in str(excinfo.value) | ||
|
||
def test_post_products_missing_id(): | ||
products = Products() | ||
response = products.post() | ||
assert response == ({'status': 'error parsing json'}, 500) | ||
|
||
def test_put_products_missing_json(): | ||
products = Products() | ||
response = products.put() | ||
assert response == ({'status': 'product not updated because id is not provided'}, 500) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
flask~=3.0 | ||
flask_restful~=0.3 | ||
pymongo~=4.6 | ||
pymongo~=4.6 | ||
pytest~=7.4 | ||
coverage~=7.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters