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
|
|
|
"""
|
|
|
|
|
|
|
|
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):
|
2012-05-07 14:27:54 +02:00
|
|
|
a_herd = HerdFactory.create()
|
2012-05-07 10:56:54 +02:00
|
|
|
response = self.get("chart_herd", chart="pie-packages",
|
2012-05-07 14:27:54 +02:00
|
|
|
herd=a_herd.herd)
|
2012-05-07 10:56:54 +02:00
|
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
|
|
|
|
def test_maintainer(self):
|
2012-05-07 14:27:54 +02:00
|
|
|
a_maintainer = MaintainerFactory.create()
|
2012-05-07 10:56:54 +02:00
|
|
|
response = self.get("chart_maintainer", chart="pie-packages",
|
2012-05-07 14:27:54 +02:00
|
|
|
maintainer_id=a_maintainer.pk)
|
2012-05-07 10:56:54 +02:00
|
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
|
|
|
|
def test_category(self):
|
2012-05-07 14:27:54 +02:00
|
|
|
a_category = PackageFactory.create().category
|
2012-05-07 10:56:54 +02:00
|
|
|
response = self.get("chart_category", chart="pie-packages",
|
2012-05-07 14:27:54 +02:00
|
|
|
category=a_category)
|
2012-05-07 10:56:54 +02:00
|
|
|
self.assertEqual(response.status_code, 200)
|