예제 #1
0
class TestUnitBoxesView(TestCase):
    def setUp(self):
        super(TestUnitBoxesView, self).setUp()

        self.view = BoxesViewMixin()

    def test_get_type_dict(self):
        self.assertEqual('dict', self.view.get_type(dict()))

    def test_get_type_brain(self):
        self.assertEqual('brain', self.view.get_type(MockBrain()))

    def test_get_type_widget(self):
        mock_widget = Widget(None)
        alsoProvides(mock_widget, IFieldWidget)

        self.assertEqual('widget', self.view.get_type(mock_widget))

    def test_get_type_task(self):
        self.assertEqual('globalindex_task',
                         self.view.get_type(Task(123, 'foo')))

    def test_invalid_value_raises(self):
        class Foo(object):
            pass

        with self.assertRaises(ValueError):
            self.view.get_type(Foo())
예제 #2
0
class TestUnitBoxesView(TestCase):

    def setUp(self):
        super(TestUnitBoxesView, self).setUp()

        self.view = BoxesViewMixin()

    def test_get_type_dict(self):
        self.assertEqual('dict', self.view.get_type(dict()))

    def test_get_type_brain(self):
        self.assertEqual('brain', self.view.get_type(MockBrain()))

    def test_get_type_widget(self):
        mock_widget = Widget(None)
        alsoProvides(mock_widget, IFieldWidget)

        self.assertEqual('widget', self.view.get_type(mock_widget))

    def test_get_type_task(self):
        self.assertEqual('globalindex_task',
                         self.view.get_type(Task(123, 'foo')))

    def test_invalid_value_raises(self):
        class Foo(object):
            pass

        with self.assertRaises(ValueError):
            self.view.get_type(Foo())
예제 #3
0
    def setUp(self):
        super(TestUnitBoxesView, self).setUp()

        self.view = BoxesViewMixin()
예제 #4
0
    def setUp(self):
        super(TestUnitBoxesView, self).setUp()

        self.view = BoxesViewMixin()