feat: tests!

This commit is contained in:
pwgen2155 2024-02-29 10:28:24 +11:00
parent 7647e76596
commit f32091084f
3 changed files with 53 additions and 2 deletions

View file

@ -17,3 +17,22 @@ steps:
- ./manage.py migrate --database=default
- ./manage.py migrate --database=game
- ./manage.py collectstatic --no-input
- ./manage.py test
---
kind: pipeline
name: deploy
type: ssh
server:
host: irc.l3.lv
user:
from_secret: username
password:
from_secret: password
steps:
- name: clone
commands:
- git clone
- docker compose up -d --build

View file

@ -1,3 +1,35 @@
from django.test import TestCase
from django.test import TestCase, Client
from django.urls import reverse
# Create your tests here.
class TestCalls(TestCase):
databases = {"default", "game"}
def setUp(self):
# Every test needs a client.
self.client = Client()
def test_home(self):
response = self.client.get('/')
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'dawdle/front.html')
self.assertTemplateUsed(response, 'dawdle/base.html')
def test_about(self):
response = self.client.get('/about')
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'dawdle/about.html')
self.assertTemplateUsed(response, 'dawdle/base.html')
#def test_map(self):
# response = self.client.get('/map')
# self.assertEqual(response.status_code, 200)
def test_players(self):
response = self.client.get('/players')
self.assertEqual(response.status_code, 200)
def test_quest(self):
response = self.client.get('/quest')
self.assertEqual(response.status_code, 200)
def test_timelapse(self):
response = self.client.get('/timelapse')
self.assertEqual(response.status_code, 200)

View file

@ -24,7 +24,7 @@ SECRET_KEY = 'GKF+J8ifZXIcW0sMP4+EOxD4DHTAZSN0FXbw/l9qP8Zchy1Xd1Z5wPbIEhOj'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ['irc.l3.lv', '127.0.0.1']
ALLOWED_HOSTS = ['irc.l3.lv', '127.0.0.1', 'localhost']
# Application definition