charts test
This commit is contained in:
parent
cb3dcaf713
commit
46489c84a4
@ -13,15 +13,15 @@ def random_string(length=10):
|
|||||||
class HerdFactory(factory.Factory):
|
class HerdFactory(factory.Factory):
|
||||||
FACTORY_FOR = Herd
|
FACTORY_FOR = Herd
|
||||||
|
|
||||||
herd = 'Test Herd'
|
herd = factory.LazyAttribute(lambda a: random_string())
|
||||||
email = 'herd@testherd.com'
|
email = factory.LazyAttribute(lambda a: "%s@example.com" % a.herd)
|
||||||
|
|
||||||
|
|
||||||
class MaintainerFactory(factory.Factory):
|
class MaintainerFactory(factory.Factory):
|
||||||
FACTORY_FOR = Maintainer
|
FACTORY_FOR = Maintainer
|
||||||
|
|
||||||
herd = 'Test Maintainer'
|
name = factory.LazyAttribute(lambda a: random_string())
|
||||||
email = 'maintainer@testmaintainer.com'
|
email = factory.LazyAttribute(lambda a: "%s@example.com" % a.name)
|
||||||
|
|
||||||
|
|
||||||
class PackageFactory(factory.Factory):
|
class PackageFactory(factory.Factory):
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
from euscanwww.djeuscan.tests import SystemTestCase
|
from djeuscan.tests import SystemTestCase
|
||||||
|
from djeuscan.tests.euscan_factory import MaintainerFactory, HerdFactory, \
|
||||||
|
PackageFactory
|
||||||
|
|
||||||
|
|
||||||
class ChartTests(SystemTestCase):
|
class ChartTests(SystemTestCase):
|
||||||
@ -6,6 +8,12 @@ class ChartTests(SystemTestCase):
|
|||||||
Test charts
|
Test charts
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(ChartTests, self).setUp()
|
||||||
|
self.a_herd = HerdFactory.create()
|
||||||
|
self.a_maintainer = MaintainerFactory.create()
|
||||||
|
self.a_category = PackageFactory.create().category
|
||||||
|
|
||||||
def test_statistics(self):
|
def test_statistics(self):
|
||||||
response = self.get("statistics")
|
response = self.get("statistics")
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
@ -59,3 +67,18 @@ class ChartTests(SystemTestCase):
|
|||||||
def test_versions_option_incorrect(self):
|
def test_versions_option_incorrect(self):
|
||||||
response = self.get("chart", chart="versions-trololol")
|
response = self.get("chart", chart="versions-trololol")
|
||||||
self.assertEqual(response.status_code, 404)
|
self.assertEqual(response.status_code, 404)
|
||||||
|
|
||||||
|
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)
|
||||||
|
@ -39,3 +39,4 @@ class EuscanResultModelTests(unittest.TestCase):
|
|||||||
result1 = EuscanResultFactory.create(datetime=datetime(2012, 04, 01))
|
result1 = EuscanResultFactory.create(datetime=datetime(2012, 04, 01))
|
||||||
result2 = EuscanResultFactory.create(datetime=datetime(2012, 01, 01))
|
result2 = EuscanResultFactory.create(datetime=datetime(2012, 01, 01))
|
||||||
self.assertEqual(result1, EuscanResult.objects.latest())
|
self.assertEqual(result1, EuscanResult.objects.latest())
|
||||||
|
self.assertNotEqual(result2, EuscanResult.objects.latest())
|
||||||
|
Loading…
Reference in New Issue
Block a user