def test_client_get_metadata(watchman_service): """ Test client's ability to get metadata from some target """ client = Client(project=tu.GORDO_PROJECT) metadata = client.get_metadata() assert isinstance(metadata, dict) # Can't get metadata for non-existent target with pytest.raises(ValueError): client = Client(project=tu.GORDO_PROJECT, target="no-such-target") client.get_metadata()
def metadata(ctx: click.Context, output_file: typing.Optional[typing.IO[str]]): """ Get metadata from a given endpoint """ client = Client(*ctx.obj["args"], **ctx.obj["kwargs"]) metadata = client.get_metadata() if output_file: json.dump(metadata, output_file) click.secho(f"Saved metadata json to file: '{output_file}'") else: pprint(metadata) return metadata