def test_global_valid(self): """Testing WebAPIToken.validate_policy with valid '*' section""" WebAPIToken.validate_policy({ 'resources': { '*': { 'allow': ['*'], 'block': ['POST'], } } })
def test_resource_id_valid(self): """Testing WebAPIToken.validate_policy with <resource>.<id> valid""" WebAPIToken.validate_policy({ 'resources': { 'repository': { '42': { 'allow': ['*'], 'block': ['POST'], }, } } })
def test_empty(self): """Testing WebAPIToken.validate_policy with empty policy""" WebAPIToken.validate_policy({})