Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Prepara o ambiente de testes #3

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[run]
branch=True
source=.
omit=project/wsgi.py, manage.py
1 change: 1 addition & 0 deletions .env-example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_URL=postgres://postgres@localhost/blog
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ __pycache__/
*.so

# Distribution / packaging
.env
.venv
.Python
.python-version
env/
bin/
build/
Expand Down
19 changes: 13 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
language: python
python:
- "2.7"
- 2.7
- 3.4
env:
- DJANGO=1.7 DB=sqlite3
global:
- DATABASE_URL=postgres://postgres@localhost/travis_ci_test
services:
- postgresql
install:
- pip install -r requirements.txt --use-mirrors
- pip install -r requirements.txt
before_script:
- psql -c 'create database travis_ci_test;' -U postgres
- python manage.py migrate --noinput
script:
- python manage.py makemigrations
- python manage.py migrate
- python manage.py test
- coverage run manage.py test
after_success:
- coveralls
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ublog
=====

[![Coverage Status](https://coveralls.io/repos/igr-santos/ublog/badge.png)](https://coveralls.io/r/igr-santos/ublog) [![Build Status](https://travis-ci.org/igr-santos/ublog.svg?branch=master)](https://travis-ci.org/igr-santos/ublog)
[![Build Status](https://travis-ci.org/pythonclub/ublog.svg)](https://travis-ci.org/pythonclub/ublog) [![Coverage Status](https://img.shields.io/coveralls/pythonclub/ublog.svg)](https://coveralls.io/r/pythonclub/ublog)

Plataforma para Blog colaborativo escrita em Python
2 changes: 1 addition & 1 deletion blog/migrations/0002_auto_20140910_0228.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('object_id', models.IntegerField(verbose_name='Object id', db_index=True)),
('content_type', models.ForeignKey(related_name='blog_taggedwhatever_tagged_items', verbose_name='Content type', to='contenttypes.ContentType')),
('tag', models.ForeignKey(related_name=b'blog_taggedwhatever_items', to='blog.Tag')),
('tag', models.ForeignKey(related_name='blog_taggedwhatever_items', to='blog.Tag')),
],
options={
'abstract': False,
Expand Down
13 changes: 12 additions & 1 deletion blog/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# -*- coding: utf-8 -*-

from django.test import TestCase

# Create your tests here.

class EntryListTest(TestCase):
def setUp(self):
self.res = self.client.get('/')

def test_status_code(self):
self.assertEqual(self.res.status_code, 200)

def test_template_used(self):
self.assertTemplateUsed('entry_list.html')
9 changes: 3 additions & 6 deletions project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,9 @@
# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
import dj_database_url
DATABASES = {'default': dj_database_url.config()}


SOUTH_MIGRATION_MODULES = {
'taggit': 'taggit.south_migrations',
Expand Down
11 changes: 8 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Django==1.7
Markdown==2.4.1
argparse==1.2.1

dj-database-url==0.3.0
django-markdown==0.6.1
django-taggit==0.12.1
wsgiref==0.1.2

psycopg2==2.5.4

coverage==3.7.1
python-coveralls==2.4.2
tox==1.7.2
7 changes: 7 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[tox]
envlist = py27,py34
skipsdist = True

[testenv]
deps = -rrequirements.txt
commands = python manage.py test