Skip to content

Commit

Permalink
Coverage sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyontour committed May 21, 2015
1 parent 6172bae commit 319373c
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 60 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ source = .
# Regexes for lines to exclude from consideration
omit =
venv/*
config/settings/live.py
config/wsgi.py
fabfile.py

exclude_lines =
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SETTINGS=config.settings.dev
APPS=articles accounts
APPS=articles accounts config
PYTHON=python
SECRET_KEY=THIS_IS_NOT_A_SECRET_REDEFINE_IN_LOCAL_MK
-include local.mk
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
A basic blog site in Django

[![Build Status](https://travis-ci.org/tobyontour/basic-blog.svg?branch=master)](https://travis-ci.org/tobyontour/basic-blog)
[![Coverage Status](https://coveralls.io/repos/tobyontour/basic-blog/badge.svg)](https://coveralls.io/r/tobyontour/basic-blog)
[![Coverage Status](https://coveralls.io/repos/tobyontour/basic-blog/badge.svg?branch=master)](https://coveralls.io/r/tobyontour/basic-blog?branch=master)

# Licence
The theme that is in the /theme directory is licenced under the conditions
Expand Down
Empty file removed accounts/templatetags/__init__.py
Empty file.
7 changes: 0 additions & 7 deletions accounts/templatetags/addcss.py

This file was deleted.

30 changes: 0 additions & 30 deletions config/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,3 @@
Replace this with more appropriate tests for your application.
"""

from django.test import TestCase
from django.contrib.auth.models import User
from articles.models import Article

class HomeTest(TestCase):
def setUp(self):
user = User.objects.create_user('testuser', 'testuser@example.com', 'testuser')

def create_articles(self, number_of_articles=1, published=True):

self.client.login(username="testuser", password="testuser")
for i in range(1, number_of_articles + 1):
response = self.client.post('/articles/new',
{
'title': 'New article %d title' % i,
'body': 'New article %d body' % i,
'published' : published
}, follow=True)
self.assertTrue(response.status_code == 200)
self.client.logout()
self.assertTrue(len(Article.objects.all()) == number_of_articles)

def test_homepage(self):
self.create_articles(20)
response = self.client.get('/')
self.assertTemplateUsed(response, 'home.html')

self.assertTrue('articles' in response.context)
self.assertTrue(len(response.context['articles']) == 10)

21 changes: 0 additions & 21 deletions config/views.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,2 @@
# Create your views here.
#from django.utils.text import slugify
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound, HttpResponseForbidden
#from django.contrib.auth.decorators import login_required
#from django.shortcuts import get_object_or_404, render_to_response
#from django.core.paginator import Paginator, PageNotAnInteger
#from django.contrib.auth.models import User
#from django.core.urlresolvers import reverse
#from django.contrib import messages
#from django.views.decorators.cache import cache_page, never_cache
from articles.models import Article
from django.template import RequestContext, loaderne
from django.conf import settings

def home(request):
page_size = 10
t = loader.get_template('home.html')
c = RequestContext(request, {
'articles': Article.objects.filter(published=True).filter(is_page=False).order_by('-created')[:page_size],
'header_image': getattr(settings, 'homepage_image', None),
'homepage': True,
})
return HttpResponse(t.render(c))

0 comments on commit 319373c

Please sign in to comment.