File tree Expand file tree Collapse file tree 3 files changed +67
-0
lines changed Expand file tree Collapse file tree 3 files changed +67
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Python - Lint and Test
2
+ on :
3
+ push :
4
+ branches :
5
+ - main
6
+ paths :
7
+ - " code/function/**"
8
+ - " tests/**"
9
+ - " requirements.txt"
10
+ - " .github/workflows/python.yml"
11
+ pull_request :
12
+ branches :
13
+ - main
14
+ paths :
15
+ - " code/function/**"
16
+ - " tests/**"
17
+ - " requirements.txt"
18
+ - " .github/workflows/python.yml"
19
+
20
+ jobs :
21
+ lint :
22
+ name : Lint and Test
23
+ runs-on : ubuntu-latest
24
+
25
+ steps :
26
+ # Setup Python 3.10
27
+ - name : Setup Python 3.10
28
+ id : python_setup
29
+ uses : actions/setup-python@v4
30
+ with :
31
+ python-version : " 3.10"
32
+
33
+ # Checkout repository
34
+ - name : Check Out Repository
35
+ id : checkout_repository
36
+ uses : actions/checkout@v3
37
+
38
+ # Run Python Tests
39
+ - name : Run Python Tests
40
+ id : python_test
41
+ run : |
42
+ pip install -r requirements.txt -q
43
+ python -m pytest
Original file line number Diff line number Diff line change 1
1
pre-commit ~= 3.3.2
2
+ pytest ~= 7.3.1
Original file line number Diff line number Diff line change
1
+ import pytest
2
+ from fastapi .testclient import TestClient
3
+
4
+ from code .function .core .config import settings
5
+ from code .function .main import app
6
+
7
+
8
+ @pytest .fixture (scope = "module" )
9
+ def client () -> TestClient :
10
+ return TestClient (app )
11
+
12
+
13
+ @pytest .mark .parametrize ("version" , ("v1" ,))
14
+ def test_get_heartbeat (client , version ):
15
+ # arrange
16
+ path = f"/corrector/{ version } /heartbeat"
17
+
18
+ # action
19
+ response = client .get (path )
20
+
21
+ # assert
22
+ assert response .status_code == 200
23
+ assert response .json () == {"isAlive" : True }
You can’t perform that action at this time.
0 commit comments