Exemplo n.º 1
0
            with mock.patch("photons_app.collector.Register", FakeRegister):
                with mock.patch.multiple(Register
                    , recursive_import_known = recursive_import_known
                    , recursive_resolve_imported = recursive_resolve_imported
                    ):
                    Collector().setup_addon_register({}, None)

            recursive_import_known.assert_called_once_with()
            recursive_resolve_imported.assert_called_once_with()
            self.assertEqual(called, ["recursive_import_known", "recursive_resolve_imported"])

    describe "extra_prepare_after_activation":
        it "calls post_register":
            register = mock.Mock(name="register")
            collector = Collector()
            collector.register = register

            configuration = {}
            args_dict = mock.Mock(name="args_dict")

            collector.extra_prepare_after_activation(configuration, args_dict)

            register.post_register.assert_called_once_with({"lifx.photons": {}})

        it "creates and sets up a task finder":
            configuration = {}
            args_dict = mock.Mock(name='args_dict')

            collector = Collector()
            collector.register = mock.Mock(name='register')
Exemplo n.º 2
0
                with mock.patch.multiple(
                    Register,
                    recursive_import_known=recursive_import_known,
                    recursive_resolve_imported=recursive_resolve_imported,
                ):
                    Collector().setup_addon_register({}, None)

            recursive_import_known.assert_called_once_with()
            recursive_resolve_imported.assert_called_once_with()
            assert called == ["recursive_import_known", "recursive_resolve_imported"]

    describe "extra_prepare_after_activation":
        it "calls post_register":
            register = mock.Mock(name="register")
            collector = Collector()
            collector.register = register

            final_future = asyncio.Future()
            photons_app = mock.Mock(name="photons_app", final_future=final_future)

            configuration = {"photons_app": photons_app}
            args_dict = mock.Mock(name="args_dict")

            collector.extra_prepare_after_activation(configuration, args_dict)
            assert configuration["final_future"] is final_future

            register.post_register.assert_called_once_with({"lifx.photons": {}})

        it "creates and sets up a task finder":
            final_future = asyncio.Future()
            photons_app = mock.Mock(name="photons_app", final_future=final_future)