Browse Source

Setting up tests

pull/7/head
Pēteris Caune 10 years ago
parent
commit
4057759df6
7 changed files with 27 additions and 11 deletions
  1. +8
    -0
      hc/.travis.yml
  2. +0
    -3
      hc/front/tests.py
  3. +0
    -0
      hc/front/tests/__init__.py
  4. +8
    -0
      hc/front/tests/test_basics.py
  5. +9
    -6
      hc/settings.py
  6. +1
    -1
      templates/docs.html
  7. +1
    -1
      templates/index.html

+ 8
- 0
hc/.travis.yml View File

@ -0,0 +1,8 @@
language: python
python:
- "3.4"
install: "pip install -r requirements.txt"
addons:
postgresql: "9.4"
script:
- python manage.py test hc.front

+ 0
- 3
hc/front/tests.py View File

@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.

+ 0
- 0
hc/front/tests/__init__.py View File


+ 8
- 0
hc/front/tests/test_basics.py View File

@ -0,0 +1,8 @@
from django.test import TestCase
class BasicsTestCase(TestCase):
def test_it_shows_welcome(self):
r = self.client.get("/")
self.assertContains(r, "Welcome", status_code=200)

+ 9
- 6
hc/settings.py View File

@ -15,7 +15,12 @@ import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
hc_config = json.loads(open(os.path.expanduser("~/hc_config.json")).read())
p = os.path.expanduser("~/hc_config.json")
if os.path.exists(p):
hc_config = json.loads(open(p).read())
else:
print("~/hc_config.json does not exist, using defaults")
hc_config = {}
# Quick-start development settings - unsuitable for production # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
@ -84,10 +89,8 @@ DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'hc', 'NAME': 'hc',
'USER': 'hc',
'USER': 'postgres',
'PASSWORD': '', 'PASSWORD': '',
'HOST': '192.168.1.112',
'PORT': 5432,
'TEST': {'CHARSET': 'UTF8'} 'TEST': {'CHARSET': 'UTF8'}
} }
} }
@ -113,7 +116,7 @@ STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]
# AWS # AWS
EMAIL_BACKEND = 'django_ses_backend.SESBackend' EMAIL_BACKEND = 'django_ses_backend.SESBackend'
AWS_SES_ACCESS_KEY_ID = hc_config["aws_ses_access_key"]
AWS_SES_SECRET_ACCESS_KEY = hc_config["aws_ses_secret_key"]
AWS_SES_ACCESS_KEY_ID = hc_config.get("aws_ses_access_key")
AWS_SES_SECRET_ACCESS_KEY = hc_config.get("aws_ses_secret_key")
AWS_SES_REGION_NAME = 'eu-west-1' AWS_SES_REGION_NAME = 'eu-west-1'
AWS_SES_REGION_ENDPOINT = 'email.eu-west-1.amazonaws.com' AWS_SES_REGION_ENDPOINT = 'email.eu-west-1.amazonaws.com'

+ 1
- 1
templates/docs.html View File

@ -33,7 +33,7 @@
In bash scripts, you can use <code>wget</code> or <code>curl</code> to run the requests: In bash scripts, you can use <code>wget</code> or <code>curl</code> to run the requests:
</p> </p>
<pre> <pre>
wget https://healthchecks.io/ping/b2012751-c542-4deb-b054-ff51322102b9/
wget https://healthchecks.io/ping/b2012751-c542-4deb-b054-ff51322102b9/ -O /dev/null
</pre> </pre>
<h3>When notifications are sent</h3> <h3>When notifications are sent</h3>


+ 1
- 1
templates/index.html View File

@ -29,7 +29,7 @@
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="bash"> <div role="tabpanel" class="tab-pane active" id="bash">
<pre>wget https://healthchecks.io/ping/b2012751-c542-4deb-b054-ff51322102b9/
<pre>wget https://healthchecks.io/ping/b2012751-c542-4deb-b054-ff51322102b9/ -O /dev/null
</pre> </pre>
</div> </div>
<div role="tabpanel" class="tab-pane" id="python"> <div role="tabpanel" class="tab-pane" id="python">


Loading…
Cancel
Save