Esempio n. 1
0
def test_is_resource_version_id():
    """
    Test whether the is_resource_version_id() method of the Id class works correctly.
    """
    assert Id.is_resource_version_id("test::Resource[agent,key=id],v=3")
    assert Id.is_resource_version_id("test::mod::Resource[agent,key=id],v=3")
    assert not Id.is_resource_version_id("test::Resource[agent,key=id]")
    assert not Id.is_resource_version_id("test::mod::Resource[agent,key=id]")
    assert not Id.is_resource_version_id("test::Resource")
Esempio n. 2
0
def validate_resource_version_id(ctx: click.Context,
                                 option: Union[click.Option, click.Parameter],
                                 value: str) -> ResourceVersionIdStr:
    if not Id.is_resource_version_id(value):
        raise click.BadParameter(value)
    return ResourceVersionIdStr(value)