Skip to content

Commit e74e1c5

Browse files
authored
Merge pull request #15 from TaskarCenterAtUW/dev
upgrade osw-validation to 2.0
2 parents eb8de14 + 57595f3 commit e74e1c5

17 files changed

+26
-38
lines changed

.github/workflows/dev_workflow.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
types:
77
- closed
88
workflow_dispatch:
9+
permissions:
10+
id-token: write
11+
contents: read
912

1013
jobs:
1114
Build:
@@ -29,9 +32,12 @@ jobs:
2932
name: Development
3033
runs-on: ubuntu-latest
3134
steps:
35+
- name: Login to Azure
36+
uses: azure/login@v2.0.0
37+
with:
38+
creds: ${{secrets.TDEI_CORE_AZURE_CREDS}}
3239
- name: Deploy to Dev
3340
uses: azure/webapps-deploy@v2
3441
with:
3542
app-name: ${{ secrets.AZURE_WEBAPP_NAME }}
36-
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
3743
images: ${{ secrets.REGISTRY_DOMAIN }}/${{ secrets.REGISTRY_REPO }}:${{ github.sha }}

.github/workflows/stage_workflow.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
types:
77
- closed
88
workflow_dispatch:
9+
permissions:
10+
id-token: write
11+
contents: read
912

1013
jobs:
1114
Build:
@@ -29,9 +32,12 @@ jobs:
2932
name: Stage
3033
runs-on: ubuntu-latest
3134
steps:
35+
- name: Login to Azure
36+
uses: azure/login@v2.0.0
37+
with:
38+
creds: ${{secrets.TDEI_CORE_AZURE_CREDS}}
3239
- name: Deploy to Stage
3340
uses: azure/webapps-deploy@v2
3441
with:
3542
app-name: ${{ secrets.AZURE_WEBAPP_NAME }}
36-
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
3743
images: ${{ secrets.REGISTRY_DOMAIN }}/${{ secrets.REGISTRY_REPO }}:${{ github.sha }}.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Make sure you have set up the project properly before running the tests, see abo
116116
1. `python test_report.py`
117117
2. Above command will run all test cases and generate the html report, in `reports` folder at the root level.
118118
3. To run the coverage
119-
1. `coverage run --source=src -m unittest discover -s tests/unit_tests`
119+
1. `python -m coverage run --source=src -m unittest discover -s tests/unit_tests`
120120
2. Above command will run all the unit test cases.
121121
3. To generate the coverage report in console
122122
1. `coverage report`

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ uvicorn==0.20.0
77
coverage==7.2.7
88
html_testRunner==1.2.1
99
httpx==0.24.1
10-
python-osw-validation==0.0.5
10+
python-osw-validation==0.2.1

src/osw_validator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from .validation import Validation
1010
from .models.queue_message_content import Upload, ValidationResult
1111
from .config import Settings
12+
import threading
1213

1314
logging.basicConfig()
1415
logger = logging.getLogger('OSW_VALIDATOR')
@@ -40,7 +41,9 @@ def process(message) -> None:
4041
if message is not None:
4142
queue_message = QueueMessage.to_dict(message)
4243
upload_message = Upload.data_from(queue_message)
43-
self.validate(upload_message)
44+
process_thread = threading.Thread(target=self.validate, args=[upload_message])
45+
process_thread.start()
46+
# self.validate(upload_message)
4447

4548
self.listening_topic.subscribe(subscription=self.subscription_name, callback=process)
4649

test_report.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# Define your test cases
55
from tests.unit_tests.test_queue_message_content import TestUpload, TestUploadData, TestToJson, TestValidationResult
6-
from tests.unit_tests.test_validation import TestSuccessValidation, TestFailureValidation
6+
from tests.unit_tests.test_validation import TestOtherValidation, TestValidation
77
from tests.unit_tests.test_osw_validator import TestOSWValidator
88
from tests.unit_tests.test_main import TestApp
99

@@ -15,8 +15,8 @@
1515
test_suite.addTest(unittest.makeSuite(TestUploadData))
1616
test_suite.addTest(unittest.makeSuite(TestToJson))
1717
test_suite.addTest(unittest.makeSuite(TestValidationResult))
18-
test_suite.addTest(unittest.makeSuite(TestSuccessValidation))
19-
test_suite.addTest(unittest.makeSuite(TestFailureValidation))
18+
test_suite.addTest(unittest.makeSuite(TestOtherValidation))
19+
test_suite.addTest(unittest.makeSuite(TestValidation))
2020
test_suite.addTest(unittest.makeSuite(TestOSWValidator))
2121
test_suite.addTest(unittest.makeSuite(TestApp))
2222

37.2 KB
Binary file not shown.
5.2 KB
Binary file not shown.
5.2 KB
Binary file not shown.
37.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)