Permalink
Browse files

Working on controller tests.

  • Loading branch information...
BasicWolf committed Jan 9, 2013
1 parent 051ca3e commit 0b0ecdb1f9c2d39a2abfab52465ab92b84582b8a
Showing with 180 additions and 167 deletions.
  1. +2 −0 CHANGELOG
  2. +1 −6 kaylee/testsuite/__init__.py
  3. +18 −11 kaylee/testsuite/controller_tests.py
  4. +23 −16 kaylee/testsuite/helper.py
  5. +136 −134 kaylee/testsuite/storage_tests.py
View
@@ -1,6 +1,8 @@
Changelog
=========
+v0.3
+* Testsuite updated
v0.2 (23.12.12)
----------------
@@ -10,7 +10,7 @@
import unittest
import logging
from importlib import import_module
-from .helper import TestTemporalStorage, TestPermanentStorage, TestController
+from .helper import KayleeTest, TestTemporalStorage, TestPermanentStorage, TestController
logging.basicConfig(level=logging.CRITICAL)
log = logging.getLogger(__name__)
@@ -22,11 +22,6 @@
sys.path.insert(0, PROJECTS_DIR)
-
-class KayleeTest(unittest.TestCase):
- """Base class for all Kaylee tests."""
-
-
def load_tests(test_cases):
tsuite = unittest.TestSuite()
for tcase in test_cases:
@@ -1,27 +1,34 @@
# -*- coding: utf-8 -*-
-from kaylee.testsuite import (KayleeTest, load_tests, TestTemporalStorage,
+from kaylee.testsuite import (load_tests, TestTemporalStorage,
TestPermanentStorage)
from kaylee.testsuite.projects.auto_test_project import AutoTestProject
from kaylee.contrib.controllers import SimpleController
-from abc import ABCMeta
+from kaylee.testsuite.helper import SubclassTestsBase
+from abc import ABCMeta, abstractmethod
-class ControllerTestsBase(KayleeTest):
+class ControllerTestsBase(SubclassTestsBase):
__metaclass__ = ABCMeta
- # @abstractmethod
- # def init_cls(self):
- # pass
-
def setUp(self):
- pass
+ super(ControllerTestsBase, self).setUp()
+ @abstractmethod
def test_init(self):
pass
- def test_get_task(self):
- pass
+ # def test_get_task(self):
+ # ctr = self.cls_instance()
+
+
class SimpleControllerTests(ControllerTestsBase):
- pass
+ def test_init(self):
+ pass
+
+ def cls_instance(self):
+ return SimpleController('test_app',
+ AutoTestProject(),
+ TestPermanentStorage())
+
kaylee_suite = load_tests([SimpleControllerTests,])
View
@@ -1,10 +1,32 @@
-from kaylee.testsuite import KayleeTest
+import unittest
from kaylee.project import Project
from kaylee.contrib.storages import (MemoryTemporalStorage,
MemoryPermanentStorage)
from kaylee.contrib.controllers import SimpleController
from abc import ABCMeta, abstractmethod, abstractproperty
+
+class KayleeTest(unittest.TestCase):
+ """Base class for all Kaylee tests."""
+
+class SubclassTestsBase(KayleeTest):
+ """The base class for (sub)classes, e.g. controllers, storages etc.
+ tests. The idea that Kaylee provides basic tests, which can then be
+ subclassed and extentended by class-specific tests"""
+ SOME = 11
+ MANY = SOME ** 2
+
+ __metaclass__ = ABCMeta
+
+ def setUp(self):
+ self.cls = self.cls_instance().__class__
+
+ @abstractmethod
+ def cls_instance(self):
+ """Returns an instance of """
+ return None
+
+
class NonAbstractProject(Project):
def __init__(self, *args, **kwargs):
pass
@@ -44,18 +66,3 @@ def new_test_instance(project_object=None, app_name='test_app'):
project_object,
TestPermanentStorage(),
TestTemporalStorage())
-
-
-class ContribTestsBase(KayleeTests):
- """The base class for all contrib classes (controllers, storages etc.)
- tests. The idea that Kaylee provides basic contrib tests, which """
- __metaclass__ = ABCMeta
-
- @abstractmethod
- def cls_instance(self):
- """Returns an instance of """
- return None
-
- @abstractproperty
- def cls(self):
- return None
Oops, something went wrong.

0 comments on commit 0b0ecdb

Please sign in to comment.