Ejemplo n.º 1
0
    def test_proxy_plain(self):
        proxy_factory = proxy.TaskFactory(self.factory)

        proxy_factory.new_task(type=self.fake_type, owner=self.fake_owner)

        self.factory.new_task.assert_called_once_with(type=self.fake_type,
                                                      owner=self.fake_owner)
Ejemplo n.º 2
0
    def test_proxy_wrapping(self):
        proxy_factory = proxy.TaskFactory(
            self.factory,
            task_proxy_class=FakeProxy,
            task_proxy_kwargs={'dog': 'bark'},
            task_details_proxy_class=FakeProxy,
            task_details_proxy_kwargs={'dog': 'bark'})

        self.factory.new_task.return_value = 'fake_task'
        self.factory.new_task_details.return_value = 'fake_task_detail'

        task = proxy_factory.new_task(type=self.fake_type,
                                      owner=self.fake_owner)

        self.factory.new_task.assert_called_once_with(type=self.fake_type,
                                                      owner=self.fake_owner)
        self.assertIsInstance(task, FakeProxy)
        self.assertEqual(task.base, 'fake_task')

        task_details = proxy_factory.new_task_details('task_01', "input")

        self.factory.new_task_details.assert_called_once_with(
            'task_01', "input", None, None)

        self.assertIsInstance(task_details, FakeProxy)
        self.assertEqual(task_details.base, 'fake_task_detail')
Ejemplo n.º 3
0
    def test_proxy_plain(self):
        proxy_factory = proxy.TaskFactory(self.factory)

        proxy_factory.new_task(type=self.fake_type, owner=self.fake_owner)

        self.factory.new_task.assert_called_once_with(type=self.fake_type,
                                                      owner=self.fake_owner)

        proxy_factory.new_task_details("task_01", "input")

        self.factory.new_task_details.assert_called_once_with(
            "task_01", "input", None, None)
Ejemplo n.º 4
0
    def test_proxy_wrapping(self):
        proxy_factory = proxy.TaskFactory(self.factory,
                                          task_proxy_class=FakeProxy,
                                          task_proxy_kwargs={'dog': 'bark'})

        self.factory.new_task.return_value = 'fake_task'

        task = proxy_factory.new_task(type=self.fake_type,
                                      owner=self.fake_owner)

        self.factory.new_task.assert_called_once_with(type=self.fake_type,
                                                      owner=self.fake_owner)
        self.assertIsInstance(task, FakeProxy)
        self.assertEqual('fake_task', task.base)
Ejemplo n.º 5
0
    def test_proxy_wrapping(self):
        proxy_factory = proxy.TaskFactory(self.factory,
                                          proxy_class=FakeProxy,
                                          proxy_kwargs={'dog': 'bark'})
        self.factory.new_task.return_value = 'fake_task'

        task = proxy_factory.new_task(self.fake_type, self.fake_input,
                                      self.fake_owner)

        self.factory.new_task.assert_called_once_with(self.fake_type,
                                                      self.fake_input,
                                                      self.fake_owner)
        self.assertTrue(isinstance(task, FakeProxy))
        self.assertEqual(task.base, 'fake_task')