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

103 lines
3.6 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 19:09:08 +02:00
url = "chart"
args = []
kwargs = {}
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):
2012-05-07 19:09:08 +02:00
response = self.get(self.url, chart="pie-versions",
*self.args, **self.kwargs)
2012-05-06 20:03:49 +02:00
self.assertEqual(response.status_code, 200)
2012-05-07 10:19:48 +02:00
def test_pie_packages(self):
2012-05-07 19:09:08 +02:00
response = self.get(self.url, chart="pie-packages", *self.args,
**self.kwargs)
2012-05-07 10:19:48 +02:00
self.assertEqual(response.status_code, 200)
def test_packages(self):
2012-05-07 19:09:08 +02:00
response = self.get(self.url, chart="packages", *self.args,
**self.kwargs)
2012-05-07 10:19:48 +02:00
self.assertEqual(response.status_code, 200)
def test_packages_options(self):
2012-05-07 19:09:08 +02:00
response = self.get(self.url, chart="packages-small", *self.args,
**self.kwargs)
2012-05-07 10:19:48 +02:00
self.assertEqual(response.status_code, 200)
2012-05-07 19:09:08 +02:00
response = self.get(self.url, chart="packages-weekly", *self.args,
**self.kwargs)
2012-05-07 10:19:48 +02:00
self.assertEqual(response.status_code, 200)
2012-05-07 19:09:08 +02:00
response = self.get(self.url, chart="packages-monthly", *self.args,
**self.kwargs)
2012-05-07 10:19:48 +02:00
self.assertEqual(response.status_code, 200)
2012-05-07 19:09:08 +02:00
response = self.get(self.url, chart="packages-yearly", *self.args,
**self.kwargs)
2012-05-07 10:19:48 +02:00
self.assertEqual(response.status_code, 200)
def test_packages_option_incorrect(self):
2012-05-07 19:09:08 +02:00
response = self.get(self.url, chart="packages-trololol", *self.args,
**self.kwargs)
2012-05-07 10:19:48 +02:00
self.assertEqual(response.status_code, 404)
def test_versions(self):
2012-05-07 19:09:08 +02:00
response = self.get(self.url, chart="versions", *self.args,
**self.kwargs)
2012-05-07 10:19:48 +02:00
self.assertEqual(response.status_code, 200)
def test_versions_options(self):
2012-05-07 19:09:08 +02:00
response = self.get(self.url, chart="versions-small", *self.args,
**self.kwargs)
2012-05-07 10:19:48 +02:00
self.assertEqual(response.status_code, 200)
2012-05-07 19:09:08 +02:00
response = self.get(self.url, chart="versions-weekly", *self.args,
**self.kwargs)
2012-05-07 10:19:48 +02:00
self.assertEqual(response.status_code, 200)
2012-05-07 19:09:08 +02:00
response = self.get(self.url, chart="versions-monthly", *self.args,
**self.kwargs)
2012-05-07 10:19:48 +02:00
self.assertEqual(response.status_code, 200)
2012-05-07 19:09:08 +02:00
response = self.get(self.url, chart="versions-yearly", *self.args,
**self.kwargs)
2012-05-07 10:19:48 +02:00
self.assertEqual(response.status_code, 200)
def test_versions_option_incorrect(self):
2012-05-07 19:09:08 +02:00
response = self.get(self.url, chart="versions-trololol", *self.args,
**self.kwargs)
2012-05-07 10:19:48 +02:00
self.assertEqual(response.status_code, 404)
2012-05-07 10:56:54 +02:00
2012-05-07 19:09:08 +02:00
class CategoryChartTests(ChartTests):
def setUp(self):
super(CategoryChartTests, self).setUp()
self.url = "chart_category"
self.kwargs = {"category": PackageFactory.create().category}
2012-05-07 10:56:54 +02:00
2012-05-07 19:09:08 +02:00
class HerdChartTests(ChartTests):
def setUp(self):
super(HerdChartTests, self).setUp()
self.url = "chart_herd"
self.kwargs = {"herd": HerdFactory.create().herd}
class MaintainerChartTests(ChartTests):
def setUp(self):
super(MaintainerChartTests, self).setUp()
self.url = "chart_maintainer"
self.kwargs = {"maintainer_id": MaintainerFactory.create().id}