Esempio n. 1
0
    def test_builds_injector_refkw(self):
        inj = mock.Mock()
        ret = mock.Mock()
        inj.return_value = ret
        cref = "__test_ref"
        func = mock.Mock()

        res = dec.with_component(cref, None, inj)(func)
        self.assertEqual(res, ret)
        self.assertEqual(inj.call_args_list, [
            ((cref, func, cref), {}),
        ])
Esempio n. 2
0
    def test_builds_injector(self):
        inj = mock.Mock()
        ret = mock.Mock()
        inj.return_value = ret
        cref = mock.Mock()
        func = mock.Mock()

        res = dec.with_component(cref, "component", inj)(func)
        self.assertEqual(res, ret)
        self.assertEqual(inj.call_args_list, [
            ((cref, func, "component"), {}),
        ])