Permalink
Browse files

add_gridpackage partial test coverage.

  • Loading branch information...
1 parent 52bce58 commit d207f4cb629b723922e91c0bfe97e2d884946565 @akavlie committed Mar 17, 2011
Showing with 47 additions and 8 deletions.
  1. +13 −8 apps/grid/tests/test_views.py
  2. +34 −0 fixtures/test_initial_data.json
@@ -165,13 +165,18 @@ def test_add_gridpackage_view(self):
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'grid/add_grid_package.html')
- # Test form post
- #count = GridPackage.objects.count()
- #response = self.client.post(url, {
- #'package': 'TEST NAME',
- #}, follow=True)
- #self.assertEqual(GridPackage.objects.count(), count + 1)
- #self.assertContains(response, 'TEST TITLE')
+ # Test form post for existing package
+ response = self.client.post(url, {
+ 'package': 2,
+ }, follow=True)
+ self.assertContains(response,
+ ''Supertester' is already in this grid.')
+ # Test form post for new package
+ response = self.client.post(url, {
+ 'package': 2,
+ }, follow=True)
+ self.assertContains(response,
+ ''Supertester' is already in this grid.')
def test_add_new_grid_package_view(self):
@@ -201,7 +206,7 @@ def test_add_new_grid_package_view(self):
def test_ajax_grid_list_view(self):
- url = reverse('ajax_grid_list') + '?q=Testing&package_id=2'
+ url = reverse('ajax_grid_list') + '?q=Testing&package_id=4'
response = self.client.get(url)
self.assertContains(response, 'Testing')
@@ -33,6 +33,14 @@
"pk" : 3
},
{ "fields" : { "created" : "2010-01-01 12:00:00",
+ "grid" : 1,
+ "modified" : "2010-01-01 12:00:00",
+ "package" : 3
+ },
+ "model" : "grid.gridpackage",
+ "pk" : 3
+ },
+ { "fields" : { "created" : "2010-01-01 12:00:00",
"grid" : 2,
"modified" : "2010-01-01 12:00:00",
"package" : 3
@@ -41,6 +49,14 @@
"pk" : 4
},
{ "fields" : { "created" : "2010-01-01 12:00:00",
+ "grid" : 1,
+ "modified" : "2010-01-01 12:00:00",
+ "package" : 2
+ },
+ "model" : "grid.gridpackage",
+ "pk" : 5
+ },
+ { "fields" : { "created" : "2010-01-01 12:00:00",
"description" : "Does this package come with tests?",
"grid" : 1,
"modified" : "2010-01-01 12:00:00",
@@ -130,6 +146,24 @@
"model" : "package.package",
"pk" : 3
},
+ { "fields" : { "category" : 1,
+ "created" : "2010-01-01 15:00:00",
+ "modified" : "2010-01-02 20:00:00",
+ "participants" : "pydanny",
+ "pypi_downloads" : 0,
+ "pypi_url" : "",
+ "related_packages" : [ ],
+ "repo_commits" : 0,
+ "repo_description" : "Yet another test package, with no grid affiliation.",
+ "repo_forks" : 0,
+ "repo_url" : "",
+ "repo_watchers" : 0,
+ "slug" : "another-test",
+ "title" : "Another Test"
+ },
+ "model" : "package.package",
+ "pk" : 4
+ },
{ "fields" : { "name" : "Moderators",
"permissions" : [ [ "delete_gridpackage",
"grid",

0 comments on commit d207f4c

Please sign in to comment.