Example #1
0
    def test_reset_error(self):
        database = LocatorsDatabase()

        database.path = io.StringIO("some-error")
        database.load()

        assert database.error is not None
        assert len(database.locators) == 0

        database.path = to_stream(CURRENT)
        database.load()

        assert database.error is None
        assert len(database.locators) == 4
Example #2
0
    def test_resolve_paths(self):
        database = LocatorsDatabase(to_stream(CURRENT))
        database.load()

        database.path = "/example/root/path/locators.json"

        locator = database.resolve("RobotSpareBin.Logo")
        assert isinstance(locator, ImageLocator)
        assert Path(locator.path) == Path(
            "/example/root/path/relative/locator/path.png")
        assert Path(locator.source) == Path("/absolute/locator/path.png")