def test_get_targets_from_environment(self):
        target_database = EnvTargetDatabase()
        target_repository = TargetRegistry(target_db=target_database)

        target = target_repository.find_one(target_id=1)
        assert target is not None
        assert target["drive"] == "D:\\"
        assert target["serial_port"] == "COM1"
        assert target["pca"] == "PCA10028"
        assert target["segger_sn"] == "1231233333"

        target = target_repository.find_one(target_id=2)
        assert target is not None
        assert target["drive"] == "E:\\"
        assert target["serial_port"] == "COM2"
        assert target["pca"] == "PCA10028"
        assert target["segger_sn"] == "3332222111"
コード例 #2
0
    def test_get_targets_from_environment(self):
        target_database = EnvTargetDatabase()
        target_repository = TargetRegistry(target_db=target_database)

        target = target_repository.find_one(target_id=1)
        assert target is not None
        assert target["drive"] == "D:\\"
        assert target["serial_port"] == "COM1"
        assert target["pca"] == "PCA10028"
        assert target["segger_sn"] == "1231233333"

        target = target_repository.find_one(target_id=2)
        assert target is not None
        assert target["drive"] == "E:\\"
        assert target["serial_port"] == "COM2"
        assert target["pca"] == "PCA10028"
        assert target["segger_sn"] == "3332222111"
    def test_get_targets_from_file(self):
        target_database = FileTargetDatabase("test_targets.json")
        target_repository = TargetRegistry(target_db=target_database)

        target = target_repository.find_one(target_id=1)
        assert target is not None
        assert target["drive"] == "d:\\"
        assert target["serial_port"] == "COM7"
        assert target["pca"] == "PCA10028"
        assert target["segger_sn"] == "123123123123"

        target = target_repository.find_one(target_id=2)
        assert target is not None
        assert target["drive"] == "e:\\"
        assert target["serial_port"] == "COM8"
        assert target["pca"] == "PCA10028"
        assert target["segger_sn"] == "321321321312"
コード例 #4
0
    def test_get_targets_from_file(self):
        target_database = FileTargetDatabase("test_targets.json")
        target_repository = TargetRegistry(target_db=target_database)

        target = target_repository.find_one(target_id=1)
        assert target is not None
        assert target["drive"] == "d:\\"
        assert target["serial_port"] == "COM7"
        assert target["pca"] == "PCA10028"
        assert target["segger_sn"] == "123123123123"

        target = target_repository.find_one(target_id=2)
        assert target is not None
        assert target["drive"] == "e:\\"
        assert target["serial_port"] == "COM8"
        assert target["pca"] == "PCA10028"
        assert target["segger_sn"] == "321321321312"