def test_permissions_catalog_add(appliance): """ Tests that a catalog can be added only with the right permissions""" # This test needs to retain a reference to the catalog created when `_create_catalog` is run # from within `single_task_permission_test`, so we use a list so that we don't have to use all # sorts of global variables. This list will only ever have 1 item in it. catalogs = [] def _create_catalog(): catalogs.append( appliance.collections.catalogs.create( name=fauxfactory.gen_alphanumeric(), description="my catalog")) def _delete_catalog(): if catalogs: # See comment above list declaration for why only the first item is deleted catalogs[0].delete() test_product_features = [[ 'Everything', 'Services', 'Catalogs Explorer', 'Catalogs' ]] # Since we try to create the catalog with the same name, we obliged to delete it after creation # in order to avoid "Name has already been taken" error which makes this test "blind" to the # fact, that disallowed action actually can be performed. # TODO: remove this workaround with "lambda" test_actions = { 'Add Catalog': _create_catalog, 'Delete Catalog': _delete_catalog } tac.single_task_permission_test(appliance, test_product_features, test_actions)
def test_permissions_namespace_crud(setup_single_provider, domain): """ Tests that a namespace can be manipulated only with the right permissions""" tac.single_task_permission_test( [['Everything', 'Automate', 'Explorer']], { 'Namespace CRUD': lambda: test_namespace_crud(ta.a_namespace(domain=domain)) })
def test_permissions_catalog_add(setup_cloud_providers): """ Tests that a catalog can be added only with the right permissions""" cat = Catalog(name=rand.generate_random_string(), description="my catalog") tac.single_task_permission_test([['Services', 'Catalogs Explorer', 'Catalogs']], {'Add Catalog': cat.create})
def test_permissions_catalog_item_add(appliance, catalog, dialog, request): """Test that a catalog can be added only with the right permissions. Polarion: assignee: nansari casecomponent: Services caseimportance: high initialEstimate: 1/8h tags: service """ def _create_catalog(appliance): cat_item = appliance.collections.catalog_items.create( appliance.collections.catalog_items.GENERIC, name=fauxfactory.gen_alphanumeric(15, start="cat_item_"), description="my catalog item", display_in=True, catalog=catalog, dialog=dialog) request.addfinalizer(lambda: cat_item.delete()) test_product_features = [[ 'Everything', 'Services', 'Catalogs Explorer', 'Catalog Items' ]] test_actions = {'Add Catalog Item': _create_catalog} tac.single_task_permission_test(appliance, test_product_features, test_actions)
def test_permissions_catalog_add(setup_cloud_providers): """ Tests that a catalog can be added only with the right permissions""" cat = Catalog(name=fauxfactory.gen_alphanumeric(), description="my catalog") tac.single_task_permission_test([['Everything', 'Services', 'Catalogs Explorer', 'Catalogs']], {'Add Catalog': cat.create})
def test_permissions_catalog_add(appliance): """ Tests that a catalog can be added only with the right permissions""" # This test needs to retain a reference to the catalog created when `_create_catalog` is run # from within `single_task_permission_test`, so we use a list so that we don't have to use all # sorts of global variables. This list will only ever have 1 item in it. catalogs = [] def _create_catalog(): catalogs.append(appliance.collections.catalogs.create(name=fauxfactory.gen_alphanumeric(), description="my catalog")) def _delete_catalog(): if catalogs: # See comment above list declaration for why only the first item is deleted catalogs[0].delete() test_product_features = [['Everything', 'Services', 'Catalogs Explorer', 'Catalogs']] # Since we try to create the catalog with the same name, we obliged to delete it after creation # in order to avoid "Name has already been taken" error which makes this test "blind" to the # fact, that disallowed action actually can be performed. # TODO: remove this workaround with "lambda" test_actions = {'Add Catalog': _create_catalog, 'Delete Catalog': _delete_catalog} tac.single_task_permission_test(appliance, test_product_features, test_actions)
def test_permissions_provider_add(provider_crud): """ Tests that a provider can be added only with the right permissions""" def add(): provider_crud.create() provider_crud.validate() tac.single_task_permission_test([['Clouds', 'Cloud Providers']], {'Add Provider': add})
def test_permissions_catalog_add(): """ Tests that a catalog can be added only with the right permissions""" cat = Catalog(name=fauxfactory.gen_alphanumeric(), description="my catalog") tac.single_task_permission_test( [['Everything', 'Services', 'Catalogs Explorer', 'Catalogs']], {'Add Catalog': cat.create})
def test_permissions_catalog_add(appliance, request): """ Tests that a catalog can be added only with the right permissions""" def _create_catalog(appliance): cat = appliance.collections.catalogs.create( name=fauxfactory.gen_alphanumeric(), description="my catalog") request.addfinalizer(lambda: cat.delete()) test_product_features = [[ 'Everything', 'Services', 'Catalogs Explorer', 'Catalogs' ]] test_actions = {'Add Catalog': _create_catalog} tac.single_task_permission_test(appliance, test_product_features, test_actions)
def test_permissions_catalog_add(appliance): """ Tests that a catalog can be added only with the right permissions""" cat = Catalog(name=fauxfactory.gen_alphanumeric(), description="my catalog") test_product_features = [['Everything', 'Services', 'Catalogs Explorer', 'Catalogs']] # Since we try to create the catalog with the same name, we obliged to delete it after creation # in order to avoid "Name has already been taken" error which makes this test "blind" to the # fact, that disallowed action actually can be performed. # TODO: remove this workaround with "lambda" test_actions = {'Add Catalog': lambda _: cat.create(), 'Delete Catalog': lambda _: cat.delete()} tac.single_task_permission_test(appliance, test_product_features, test_actions)
def test_permissions_catalog_add(appliance, request): """ Tests that a catalog can be added only with the right permissions Polarion: assignee: sshveta casecomponent: Services caseimportance: medium initialEstimate: 1/8h """ def _create_catalog(appliance): cat = appliance.collections.catalogs.create(name=fauxfactory.gen_alphanumeric(), description="my catalog") request.addfinalizer(lambda: cat.delete()) test_product_features = [['Everything', 'Services', 'Catalogs Explorer', 'Catalogs']] test_actions = {'Add Catalog': _create_catalog} tac.single_task_permission_test(appliance, test_product_features, test_actions)
def test_permissions_catalog_add(appliance, request): """ Tests that a catalog can be added only with the right permissions Polarion: assignee: nansari casecomponent: Services caseimportance: medium initialEstimate: 1/8h tags: service """ def _create_catalog(appliance): cat = appliance.collections.catalogs.create(name=fauxfactory.gen_alphanumeric(), description="my catalog") request.addfinalizer(lambda: cat.delete()) test_product_features = [['Everything', 'Services', 'Catalogs Explorer', 'Catalogs']] test_actions = {'Add Catalog': _create_catalog} tac.single_task_permission_test(appliance, test_product_features, test_actions)
def test_permissions_catalog_add(appliance): """ Tests that a catalog can be added only with the right permissions""" cat = Catalog(name=fauxfactory.gen_alphanumeric(), description="my catalog") test_product_features = [[ 'Everything', 'Services', 'Catalogs Explorer', 'Catalogs' ]] # Since we try to create the catalog with the same name, we obliged to delete it after creation # in order to avoid "Name has already been taken" error which makes this test "blind" to the # fact, that disallowed action actually can be performed. # TODO: remove this workaround with "lambda" test_actions = { 'Add Catalog': lambda _: cat.create(), 'Delete Catalog': lambda _: cat.delete() } tac.single_task_permission_test(appliance, test_product_features, test_actions)
def test_permissions_catalog_item_add(appliance, catalog, dialog, request): """Test that a catalog can be added only with the right permissions. Polarion: assignee: nansari casecomponent: Services caseimportance: high initialEstimate: 1/8h tags: service """ def _create_catalog(appliance): cat_item = appliance.collections.catalog_items.create( appliance.collections.catalog_items.GENERIC, name='test_item_{}'.format(fauxfactory.gen_alphanumeric()), description="my catalog item", display_in=True, catalog=catalog, dialog=dialog ) request.addfinalizer(lambda: cat_item.delete()) test_product_features = [['Everything', 'Services', 'Catalogs Explorer', 'Catalog Items']] test_actions = {'Add Catalog Item': _create_catalog} tac.single_task_permission_test(appliance, test_product_features, test_actions)
def test_permissions_namespace_crud(setup_cloud_providers): """ Tests that a namespace can be manipulated only with the right permissions""" tac.single_task_permission_test([['Automate', 'Explorer']], {'Namespace CRUD': lambda: test_namespace_crud(a_namespace())})
def test_permissions_catalog_item_add(setup_cloud_providers, catalog_item): """ Tests that a catalog can be added only with the right permissions""" tac.single_task_permission_test( [['Services', 'Catalogs Explorer', 'Catalog Items']], {'Add Catalog Item': catalog_item.create})
def test_permissions_catalog_item_add(catalog_item): """Test that a catalog can be added only with the right permissions.""" tac.single_task_permission_test([['Everything', 'Services', 'Catalogs Explorer', 'Catalog Items']], {'Add Catalog Item': catalog_item.create})
def test_permissions_catalog_item_add(catalog_item): """Test that a catalog can be added only with the right permissions.""" tac.single_task_permission_test([['Everything', 'Services', 'Catalogs Explorer', 'Catalog Items']], {'Add Catalog Item': catalog_item.create})
def test_permissions_catalog_item_add(setup_cloud_providers, catalog_item): """Test that a catalog can be added only with the right permissions.""" tac.single_task_permission_test( [["Everything", "Services", "Catalogs Explorer", "Catalog Items"]], {"Add Catalog Item": catalog_item.create} )
def test_permissions_namespace_crud(setup_single_provider, domain): """ Tests that a namespace can be manipulated only with the right permissions""" tac.single_task_permission_test([['Everything', 'Automate', 'Explorer']], {'Namespace CRUD': lambda: test_namespace_crud(ta.a_namespace(domain=domain))})
def test_permissions_namespace_crud(setup_single_provider, domain): """ Tests that a namespace can be manipulated only with the right permissions""" tac.single_task_permission_test( [["Everything", "Automate", "Explorer"]], {"Namespace CRUD": lambda: test_namespace_crud(ta.a_namespace(domain=domain))}, )
def test_permissions_catalog_item_add(setup_cloud_providers, catalog_item): """ Tests that a catalog can be added only with the right permissions""" tac.single_task_permission_test([['Services', 'Catalogs Explorer', 'Catalog Items']], {'Add Catalog Item': catalog_item.create})
def test_permissions_provider_add(provider_crud): """ Tests that a provider can be added only with the right permissions""" def add(): provider_crud.create() provider_crud.validate() tac.single_task_permission_test([['Clouds', 'Cloud Providers']], {'Add Provider': add})
def test_permissions_namespace_crud(setup_cloud_providers): """ Tests that a namespace can be manipulated only with the right permissions""" tac.single_task_permission_test( [['Automate', 'Explorer']], {'Namespace CRUD': lambda: test_namespace_crud(a_namespace())})