Skip to content

Commit

Permalink
Update to Django 1.8.3 and fix borked test
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Greenfeld committed Jul 13, 2015
1 parent 7ea08c0 commit 839ab90
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion grid/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from grid.tests.test_templatetags import GridTest
from grid.tests.test_templatetags import GridTest
from grid.tests.test_views import FunctionalGridTest, RegressionGridTest, \
GridPermissionTest, \
GridPackagePermissionTest, \
Expand Down
5 changes: 3 additions & 2 deletions grid/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ def test_edit_grid_view(self):
self.assertContains(response, 'TEST TITLE')

def test_add_feature_view(self):
Feature.objects.all().delete() # Zero out the features

url = reverse('add_feature', kwargs={'grid_slug': 'testing'})
response = self.client.get(url)

Expand All @@ -87,12 +89,11 @@ def test_add_feature_view(self):
self.assertTemplateUsed(response, 'grid/update_feature.html')

# Test form post
count = Feature.objects.count()
response = self.client.post(url, {
'title': 'TEST TITLE',
'description': 'Just a test description'
}, follow=True)
self.assertEqual(Feature.objects.count(), count + 1)
self.assertEqual(Feature.objects.count(), 1)
self.assertContains(response, 'TEST TITLE')

def test_edit_feature_view(self):
Expand Down
10 changes: 3 additions & 7 deletions grid/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,11 @@ def add_feature(request, grid_slug, template_name="grid/update_feature.html"):
return HttpResponseForbidden("permission denied")

grid = get_object_or_404(Grid, slug=grid_slug)
feature = Feature()
form = FeatureForm(request.POST or None, instance=feature)
form = FeatureForm(request.POST or None)

if form.is_valid():
feature = Feature(
grid=grid,
title=request.POST['title'],
description=request.POST['description']
)
feature = form.save(commit=False)
feature.grid = grid
feature.save()
return HttpResponseRedirect(reverse('grid', kwargs={'slug': feature.grid.slug}))

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django==1.7.8
Django==1.8.3
boto==2.1.0
certifi==0.0.8
chardet==1.0.1
Expand Down

0 comments on commit 839ab90

Please sign in to comment.