euscanwww: test fixes and minor PEP8 fixes

Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
volpino 2012-11-01 16:28:19 +01:00
parent 1abc4d409e
commit 6f421cfe13
3 changed files with 5 additions and 3 deletions

View File

@ -99,4 +99,4 @@ class MaintainerChartTests(ChartTests):
def setUp(self):
super(MaintainerChartTests, self).setUp()
self.url = "chart_maintainer"
self.kwargs = {"maintainer_id": MaintainerFactory.create().id}
self.kwargs = {"maintainer_id": MaintainerFactory.create().pk}

View File

@ -92,7 +92,8 @@ class SectionTests(SystemTestCase):
soup = BeautifulSoup(response.content)
rows = soup.findAll("tr")
self.assertEqual(len(rows), len(items))
# the -1 is for the table heading
self.assertEqual(len(rows) - 1, len(items))
for item in items:
if attr:

View File

@ -128,6 +128,7 @@ def get_maintainer_or_404(id=None, email=None):
else:
return get_object_or_404(Maintainer, email=email)
@render_to('euscan/maintainer.html')
def maintainer(request, maintainer_id=None, maintainer_email=None):
maintainer = get_maintainer_or_404(maintainer_id, maintainer_email)
@ -567,7 +568,7 @@ def favourite_maintainer(request, maintainer_id=None, maintainer_email=None):
@ajax_request
def unfavourite_maintainer(request, maintainer_id=None, maintainer_email=None):
obj = get_maintainer_or_404(maintainer_id, maintainer_email)
get_profile(request.user).maintainers.remove(maintainer)
get_profile(request.user).maintainers.remove(obj)
return {"success": True}