Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Tests #59

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[run]
source = blogango
omit = */tests.py,*/migrations/*,

[report]
omit = */tests.py,*/migrations/*,
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ localsettings.py
MANIFEST
dist/*
example/dev.db
htmlcov/
.coverage
19 changes: 12 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ python:
- "2.6"
- "2.7"
# command to install dependencies
install:
install:
- pip install -r requirements.txt --use-mirrors
- pip install coveralls --use-mirrors
- pip install coveralls psycopg2 --use-mirrors
notifications:
slack: agiliq:4rM97fcM3RrHNA3EssNXYG3V
env:
- DJANGO_SETTINGS_MODULE=settings # use sqlite
- DJANGO_SETTINGS_MODULE=test_settings # use postgresql
services: postgresql
before_script:
- psql -c "CREATE DATABASE travisci;" -U postgres
# command to run tests
script:
- python example/manage.py test blogango.tests
- coverage run --omit='*migrations*' --source="." example/manage.py test blogango.tests

script:
- coverage run example/manage.py test blogango.tests

after_success:
- coveralls
- coveralls
6 changes: 1 addition & 5 deletions blogango/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,6 @@ def test_tagged_entries_pagination(self):
response = self.c.get(reverse('blogango_tag_details_page', args=[tag.slug, 3]))
self.assertEqual(response.status_code, 404)

def tearDown(self):
self.blog.delete()
self.user.delete()


class TestAdminActions(TestCase):
"""check for admin action on the blog"""
Expand Down Expand Up @@ -248,7 +244,7 @@ def test_add_entry(self):
self.assertEqual(BlogEntry.objects.count(), 2)
entry = BlogEntry.objects.latest('pk')
#check proper tags have been set
self.assertEqual([each.name for each in entry.tags.all()], ["testing", "testing2"])
self.assertEqual(sorted([each.name for each in entry.tags.all()]), sorted(["testing", "testing2"]))

def test_edit_entry(self):
"""Test for editing a entry in the blog"""
Expand Down
2 changes: 1 addition & 1 deletion example/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@

STATIC_URL = "/static/"


SOUTH_TESTS_MIGRATE = False
# details to send mail
# EMAIL_HOST = ''
# EMAIL_BACKEND = ''
Expand Down
12 changes: 12 additions & 0 deletions example/test_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from settings import *

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'travisci',
'USER': 'postgres',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '',
}
}