Added infra tests
This commit is contained in:
parent
719082c6a1
commit
5db6dc450a
5 changed files with 34 additions and 0 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -1,3 +1,6 @@
|
||||||
|
# python
|
||||||
|
__pycache__
|
||||||
|
|
||||||
# node/bower
|
# node/bower
|
||||||
node_modules
|
node_modules
|
||||||
bower_components
|
bower_components
|
||||||
|
@ -9,3 +12,6 @@ bower_components
|
||||||
assets/static/js/app-min.js
|
assets/static/js/app-min.js
|
||||||
assets/static/js/app.js
|
assets/static/js/app.js
|
||||||
assets/static/css
|
assets/static/css
|
||||||
|
|
||||||
|
# Tests
|
||||||
|
tests/venv
|
||||||
|
|
3
Makefile
3
Makefile
|
@ -15,3 +15,6 @@ watch:
|
||||||
deploy:
|
deploy:
|
||||||
make build
|
make build
|
||||||
lektor deploy
|
lektor deploy
|
||||||
|
|
||||||
|
deploy_tests:
|
||||||
|
bash tests/run.sh
|
||||||
|
|
1
tests/requirements.txt
Normal file
1
tests/requirements.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
requests
|
6
tests/run.sh
Normal file
6
tests/run.sh
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
virtualenv -p python3 tests/venv
|
||||||
|
source tests/venv/bin/activate
|
||||||
|
pip install -r tests/requirements.txt
|
||||||
|
python -m unittest tests.tests_deploy
|
18
tests/tests_deploy.py
Normal file
18
tests/tests_deploy.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
|
class DeployTestCase(unittest.TestCase):
|
||||||
|
def test_http_redirect_to_https(self):
|
||||||
|
result = requests.get('http://fmartingr.com', allow_redirects=False)
|
||||||
|
self.assertEqual(result.status_code, 301)
|
||||||
|
self.assertEqual(result.headers.get('Location'),
|
||||||
|
'https://fmartingr.com/')
|
||||||
|
|
||||||
|
def test_www_redirects_to_non_www(self):
|
||||||
|
request = requests.get('https://www.fmartingr.com',
|
||||||
|
allow_redirects=False)
|
||||||
|
self.assertEqual(request.status_code, 301)
|
||||||
|
self.assertEqual(request.headers.get('Location'),
|
||||||
|
'http://fmartingr.com/')
|
Loading…
Add table
Add a link
Reference in a new issue