Commit 009decd 1 parent 6fa2fa4 commit 009decd Copy full SHA for 009decd
File tree 6 files changed +44
-6
lines changed
6 files changed +44
-6
lines changed Original file line number Diff line number Diff line change @@ -23,10 +23,15 @@ jobs:
23
23
run : |
24
24
python -m pip install --upgrade pip
25
25
python -m pip install -r requirements/generated/requirements-development.txt
26
+
26
27
27
28
- name : Unit test with pytest
28
29
run : |
29
30
pip install pytest pytest-cov
31
+ # This is required because at the moment the assets are being built in the app
32
+ # When the app tries to access sass files in node_modules it will fail unless this is included
33
+ npm install
34
+
30
35
coverage run -m pytest tests/unit_tests
31
36
coverage xml
32
37
Original file line number Diff line number Diff line change 1
1
/* Example of a custom SCSS file which is combined into one SCSS application file by Flask Assets */
2
- @import " node_modules/govuk-frontend/dist/govuk/settings/index" ;
2
+ @import " node_modules/govuk-frontend/dist/govuk/settings/index.css " ;
3
3
4
4
/* Example below of using GOVUK frontend SCSS variables in custom SCSS */
5
5
.moj-skeleton {
Original file line number Diff line number Diff line change 1
1
/* Import GOVUK frontend SCSS to be compiled to CSS */
2
- @import " node_modules/govuk-frontend/dist/govuk/all" ;
2
+ @import " node_modules/govuk-frontend/dist/govuk/all.css " ;
3
3
4
4
/* Import your custom SCSS below to be compiled into one by Flask Assets */
5
5
@import " ./custom" ;
Original file line number Diff line number Diff line change
1
+ import pytest
2
+ from app import Config
3
+ from app import create_app
4
+
5
+
6
+ class TestConfig (Config ):
7
+ TESTING = True
8
+ DEBUG = True
9
+ SERVER_NAME = "localhost"
10
+ RATELIMIT_ENABLED = False
11
+ SECRET_KEY = "TEST_KEY"
12
+
13
+
14
+ @pytest .fixture (scope = "session" )
15
+ def app ():
16
+ app = create_app (TestConfig )
17
+ yield app
18
+
19
+
20
+ @pytest .fixture ()
21
+ def client (app ):
22
+ return app .test_client ()
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ def test_maintenance_page_on (app , client ):
2
+ app .config ["MAINTENANCE_MODE" ] = True
3
+ response = client .get ("/" )
4
+ assert response .status_code == 302
5
+ assert response .headers ["location" ] == "/maintenance-mode"
6
+ response = client .get ("/" , follow_redirects = True )
7
+ assert response .status_code == 503
8
+ assert response .request .path == "/maintenance-mode"
9
+
10
+
11
+ def test_maintenance_page_off (app , client ):
12
+ app .config ["MAINTENANCE_MODE" ] = False
13
+ response = client .get ("/maintenance-mode" , follow_redirects = True )
14
+ assert response .status_code == 200
15
+ assert response .request .path == "/"
You can’t perform that action at this time.
0 commit comments