Пример #1
0
    def test_no_outbound_streams(self, create_inbound_stream_mock,
                                 create_outbound_stream_mock, server_init_mock,
                                 broker_class_mock, log_warn_mock):
        """ Tests that broker started with no outbound streams specified
        and that warning is logged """
        yaml = """
                default:
                    server:
                        inbound-streams:
                            - stream:
                                name: sle_data_stream_parallel
                                input: sle_data_stream_ccsds
                                handlers:
                                    - a_handler

                        outbound-streams:
               """
        rewrite_and_reload_config(self.test_yaml_file, yaml)

        server = Server()
        server._load_streams()

        # assert warning is logged
        log_warn_mock.assert_called_with(
            'No valid outbound stream configurations found. '
            'No data will be published.')
        # assert inbound stream is added successfully
        assert len(server.inbound_streams) == 1
Пример #2
0
    def test_no_inbound_streams(
        self,
        create_inbound_stream_mock,
        create_outbound_stream_mock,
        server_stream_plugin_mock,
        broker_class_mock,
        log_warn_mock,
    ):
        """Tests that broker started with no inbound streams specified
        and that warning is logged"""
        yaml = """
                default:
                    server:
                        inbound-streams:

                        outbound-streams:
                            - stream:
                                name: sle_data_stream_parallel
                                input:
                                    - sle_data_stream_ccsds
                                handlers:
                                    - a_handler
               """
        rewrite_and_reload_config(self.test_yaml_file, yaml)
        server = Server()
        server._load_streams()

        log_warn_mock.assert_called_with(
            "No valid inbound stream configurations found. "
            "No data will be received (or displayed).")

        assert len(server.outbound_streams) == 1