Пример #1
0
    def test_beacon_comment_expect_beacon_comment(self):
        mock_json = '{"beacon":{"comment":"hello, world"}}'
        test_configuration = Configuration()
        test_configuration.load_json(mock_json)

        beacon_comment = test_configuration.beacon_comment()

        assert beacon_comment == "hello, world"
Пример #2
0
    def test_beacon_symbol_expect_beacon_symbol(self):
        mock_json = '{"beacon":{"symbol":"i"}}'
        test_configuration = Configuration()
        test_configuration.load_json(mock_json)

        beacon_symbol = test_configuration.beacon_symbol()

        assert beacon_symbol == "i"
Пример #3
0
    def test_version_expect_version(self):
        mock_json = '{"version":4.5}'
        test_configuration = Configuration()
        test_configuration.load_json(mock_json)

        version = test_configuration.version()

        assert version == 4.5
Пример #4
0
    def test_beacon_interval_expect_beacon_interval(self):
        mock_json = '{"beacon":{"interval":30.0}}'
        test_configuration = Configuration()
        test_configuration.load_json(mock_json)

        beacon_interval = test_configuration.beacon_interval()

        assert beacon_interval == 30.0
Пример #5
0
    def test_ppm_error_expect_ppm_error(self):
        mock_json = '{"listener":{"ppm_error":"5"}}'
        test_configuration = Configuration()
        test_configuration.load_json(mock_json)

        ppm_error = test_configuration.ppm_error()

        assert ppm_error == '5'
Пример #6
0
    def test_squelch_expect_squelch(self):
        mock_json = '{"listener":{"squelch_level":"5"}}'
        test_configuration = Configuration()
        test_configuration.load_json(mock_json)

        squelch_level = test_configuration.squelch_level()

        assert squelch_level == '5'
Пример #7
0
    def test_constructor_with_json_expect_constructed(self):
        mock_json = '{"listener":{"gain":"0"}}'
        test_configuration = Configuration()
        test_configuration.load_json(mock_json)

        actual_gain = test_configuration.gain()

        assert actual_gain == '0'
Пример #8
0
    def test_beacon_symbol_table_expect_beacon_symbol_table(self):
        mock_json = '{"beacon":{"symbol_table":"/"}}'
        test_configuration = Configuration()
        test_configuration.load_json(mock_json)

        beacon_symbol_table = test_configuration.beacon_symbol_table()

        assert beacon_symbol_table == "/"
Пример #9
0
    def test_start_with_mock_instances_expect_started(self):
        mock_json = '{"listener":{"implementation": "pypacket.mocks.mock_listener.MockListener"},' + \
            '"decoder":{"implementation": "pypacket.mocks.mock_decoder.MockDecoder"}, ' + \
            '"processors": [{"name": "mock", "implementation": "pypacket.mocks.mock_processor.MockProcessor"}]}'
        log_handler = Logger()
        runtime_configuration = Configuration()
        runtime_configuration.load_json(mock_json)

        test_receiver = Receiver(log_handler, runtime_configuration)

        test_receiver.start()

        assert test_receiver.is_running is True