Exemplo n.º 1
0
def get_random_frame_picture_path():
    path = config_service.load_cfg()['paths']['frame'][
        config_service.get_mode()]
    files_list = []
    with os.scandir(path) as files:
        for file in files:
            files_list.append(path + "\\" + file.name)

    return files_list[random.randint(0, len(files_list) - 1)]
Exemplo n.º 2
0
    def test_get_directory_path_for_aircraft_server(self):
        # given
        config_service.settings['mode'] = 'server'
        expected_result = f'/home/pi/data'
        # when
        result = config_service.get_directory_path_for_aircraft()

        # then
        self.assertEqual(result, expected_result)

        # debug
        print(result)

        # after
        config_service.settings['mode'] = 'dev'

        # verify
        self.assertEqual(config_service.get_mode(), 'dev')
Exemplo n.º 3
0
    def test_get_system_hc_for_server(self):
        # given
        config_service.settings['mode'] = 'server'
        expected_result = f'\home\pi\data\hc.json'
        # when
        result = config_service.get_system_hc()

        # then
        self.assertEqual(result, expected_result)

        # debug
        print(result)

        # after
        config_service.settings['mode'] = 'dev'

        # verify
        self.assertEqual(config_service.get_mode(), 'dev')
Exemplo n.º 4
0
    def test_get_path_to_chinese_dictionary_for_server(self):
        # given
        config_service.settings['mode'] = 'server'
        expected_result = f'd:\denva\src\data\dictionary.txt'

        # when
        result = config_service.get_path_to_chinese_dictionary()

        # then
        self.assertEqual(result, expected_result)

        # debug
        print(result)

        # after
        config_service.settings['mode'] = 'dev'

        # verify
        self.assertEqual(config_service.get_mode(), 'dev')
Exemplo n.º 5
0
    def test_get_information_path_for_dev(self):
        # given
        config_service.settings['mode'] = 'dev'
        expected_result = f'D:\GitHub\denva\src\data\information.json'

        # when
        result = config_service.get_information_path()

        # then
        self.assertEqual(result, expected_result)

        # debug
        print(result)

        # after
        config_service.settings['mode'] = 'dev'

        # verify
        self.assertEqual(config_service.get_mode(), 'dev')
Exemplo n.º 6
0
    def test_set_mode_to(self):
        # when
        config_service.set_mode_to('server')

        # then
        self.assertEqual(config_service.get_mode(), 'dev')