euscanwww: test fixes and minor PEP8 fixes
Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
parent
1abc4d409e
commit
6f421cfe13
@ -99,4 +99,4 @@ class MaintainerChartTests(ChartTests):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(MaintainerChartTests, self).setUp()
|
super(MaintainerChartTests, self).setUp()
|
||||||
self.url = "chart_maintainer"
|
self.url = "chart_maintainer"
|
||||||
self.kwargs = {"maintainer_id": MaintainerFactory.create().id}
|
self.kwargs = {"maintainer_id": MaintainerFactory.create().pk}
|
||||||
|
@ -92,7 +92,8 @@ class SectionTests(SystemTestCase):
|
|||||||
soup = BeautifulSoup(response.content)
|
soup = BeautifulSoup(response.content)
|
||||||
rows = soup.findAll("tr")
|
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:
|
for item in items:
|
||||||
if attr:
|
if attr:
|
||||||
|
@ -128,6 +128,7 @@ def get_maintainer_or_404(id=None, email=None):
|
|||||||
else:
|
else:
|
||||||
return get_object_or_404(Maintainer, email=email)
|
return get_object_or_404(Maintainer, email=email)
|
||||||
|
|
||||||
|
|
||||||
@render_to('euscan/maintainer.html')
|
@render_to('euscan/maintainer.html')
|
||||||
def maintainer(request, maintainer_id=None, maintainer_email=None):
|
def maintainer(request, maintainer_id=None, maintainer_email=None):
|
||||||
maintainer = get_maintainer_or_404(maintainer_id, maintainer_email)
|
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
|
@ajax_request
|
||||||
def unfavourite_maintainer(request, maintainer_id=None, maintainer_email=None):
|
def unfavourite_maintainer(request, maintainer_id=None, maintainer_email=None):
|
||||||
obj = get_maintainer_or_404(maintainer_id, maintainer_email)
|
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}
|
return {"success": True}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user