euscan-ng/euscanwww/djeuscan/tests/test_charts.py

85 lines
3.0 KiB
Python
Raw Normal View History

2012-05-07 10:56:54 +02:00
from djeuscan.tests import SystemTestCase
from djeuscan.tests.euscan_factory import MaintainerFactory, HerdFactory, \
PackageFactory
2012-05-06 20:03:49 +02:00
class ChartTests(SystemTestCase):
"""
2012-05-07 10:19:48 +02:00
Test charts
2012-05-06 20:03:49 +02:00
"""
2012-05-07 10:56:54 +02:00
def setUp(self):
super(ChartTests, self).setUp()
self.a_herd = HerdFactory.create()
self.a_maintainer = MaintainerFactory.create()
self.a_category = PackageFactory.create().category
2012-05-06 20:03:49 +02:00
def test_statistics(self):
response = self.get("statistics")
self.assertEqual(response.status_code, 200)
def test_pie_versions(self):
response = self.get("chart", chart="pie-versions")
self.assertEqual(response.status_code, 200)
2012-05-07 10:19:48 +02:00
def test_pie_packages(self):
response = self.get("chart", chart="pie-packages")
self.assertEqual(response.status_code, 200)
def test_packages(self):
response = self.get("chart", chart="packages")
self.assertEqual(response.status_code, 200)
def test_packages_options(self):
response = self.get("chart", chart="packages-small")
self.assertEqual(response.status_code, 200)
response = self.get("chart", chart="packages-weekly")
self.assertEqual(response.status_code, 200)
response = self.get("chart", chart="packages-monthly")
self.assertEqual(response.status_code, 200)
response = self.get("chart", chart="packages-yearly")
self.assertEqual(response.status_code, 200)
def test_packages_option_incorrect(self):
response = self.get("chart", chart="packages-trololol")
self.assertEqual(response.status_code, 404)
def test_versions(self):
response = self.get("chart", chart="versions")
self.assertEqual(response.status_code, 200)
def test_versions_options(self):
response = self.get("chart", chart="versions-small")
self.assertEqual(response.status_code, 200)
response = self.get("chart", chart="versions-weekly")
self.assertEqual(response.status_code, 200)
response = self.get("chart", chart="versions-monthly")
self.assertEqual(response.status_code, 200)
response = self.get("chart", chart="versions-yearly")
self.assertEqual(response.status_code, 200)
def test_versions_option_incorrect(self):
response = self.get("chart", chart="versions-trololol")
self.assertEqual(response.status_code, 404)
2012-05-07 10:56:54 +02:00
def test_herd(self):
response = self.get("chart_herd", chart="pie-packages",
herd=self.a_herd.herd)
self.assertEqual(response.status_code, 200)
def test_maintainer(self):
response = self.get("chart_maintainer", chart="pie-packages",
maintainer_id=self.a_maintainer.pk)
self.assertEqual(response.status_code, 200)
def test_category(self):
response = self.get("chart_category", chart="pie-packages",
category=self.a_category)
self.assertEqual(response.status_code, 200)