test Tests para probar GitLab CI

parent edb064f2
Pipeline #358 passed with stage
in 8 seconds
[run]
source = indo
[report]
ignore_errors = True
omit =
*/tests/*
*/migrations/*
# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/python
image: python:3.7
# Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-a-service
services:
#- mysql:latest
- postgres:latest
variables:
POSTGRES_DB: manhattan
# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
paths:
- ~/.cache/pip/
# This is a basic example for a gem or script which doesn't use
# services such as redis or postgres
before_script:
- python3.7 -V # Print out python version for debugging
# Uncomment next line if your Django app needs a JS runtime:
# - apt-get update -q && apt-get install nodejs -yqq
- cp manhattan_project/settings-sample.py manhattan_project/settings.py
- pip install --user -r requirements.txt
- python3.7 manage.py collectstatic --noinput
# To get Django tests to work you may need to create a settings file using
# the following DATABASES:
#
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
# 'NAME': 'ci',
# 'USER': 'postgres',
# 'PASSWORD': 'postgres',
# 'HOST': 'postgres',
# 'PORT': '5432',
# },
# }
#
# and then adding `--settings app.settings.ci` (or similar) to the test command
test:
variables:
DB_NAME: "manhattan"
DB_USER: "postgres"
DB_PASSWORD: "postgres"
DB_HOST: "postgres"
DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/$POSTGRES_DB"
script:
- python3.7 manage.py test
from django.test import TestCase
from django.test import SimpleTestCase
from django.urls import reverse
# Create your tests here.
class HomeTests(SimpleTestCase):
def test_home_page_status_code(self):
response = self.client.get("/")
self.assertEqual(response.status_code, 200)
def test_view_url_by_name(self):
resp = self.client.get(reverse("home"))
self.assertEqual(resp.status_code, 200)
def test_view_uses_correct_template(self):
resp = self.client.get(reverse("home"))
self.assertEqual(resp.status_code, 200)
self.assertTemplateUsed(resp, "home.html")
class AyudaTest(SimpleTestCase):
def test_view_url_exists_at_proper_location(self):
response = self.client.get("/ayuda/")
self.assertEqual(response.status_code, 200)
def test_view_url_by_name(self):
resp = self.client.get(reverse("ayuda"))
self.assertEqual(resp.status_code, 200)
def test_view_uses_correct_template(self):
resp = self.client.get(reverse("ayuda"))
self.assertEqual(resp.status_code, 200)
self.assertTemplateUsed(resp, "ayuda.html")
......@@ -15,6 +15,7 @@ mysqlclient==1.4.2.post1
oauthlib==3.0.1
pkgconfig==1.5.1
pyjwt==1.7.1
pypandoc==1.4
python3-openid==3.1.0 ; python_version >= '3.0'
python3-saml==1.6.0
pytz==2019.1
......@@ -22,7 +23,8 @@ requests-oauthlib==1.2.0
requests==2.22.0
six==1.12.0
social-auth-app-django==3.1.0
social-auth-core[saml]==3.1.0
social-auth-core[saml]==3.2.0
sqlparse==0.3.0
urllib3==1.25.3
wheel==0.33.4
xmlsec==1.3.3
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment