def test_remove_bundle(user_policy, user_sdk: ADCMClient, sdk_client_fs): """Test that Remove bundle role is ok""" is_denied(user_sdk, BR.UploadBundle) BR.UploadBundle.value.method_call(sdk_client_fs) is_allowed(user_sdk.bundle_list()[-1], BR.RemoveBundle) delete_policy(user_policy) BR.UploadBundle.value.method_call(sdk_client_fs) is_denied(user_sdk.bundle_list()[-1], BR.RemoveBundle)
def test_bundle_can_be_removed_when_no_object_associated_with( sdk_client_fs: ADCMClient, ): """Test bundle can't be removed when related objects are absent""" bundle_path = utils.get_data_dir(__file__, "cluster_inventory_tests") init_bundle_count = len(sdk_client_fs.bundle_list()) bundle = sdk_client_fs.upload_from_fs(bundle_path) with allure.step("Remove bundle"): bundle.delete() with allure.step("Check cluster bundle is removed"): assert len(sdk_client_fs.bundle_list()) == init_bundle_count
def test_load_host_provider(sdk_client_fs: ADCMClient): """Test load hostprovider bundle""" sdk_client_fs.upload_from_fs(BUNDLES + "hostprovider_bundle") with allure.step("Check bundle list"): assert "provider_sample" in [ bundle.name for bundle in sdk_client_fs.bundle_list() ]
def test_bundle_test_list(sdk_client_fs: ADCMClient): with allure.step('Upload and get bundle list'): for i in range(1, 4): sdk_client_fs.upload_from_fs( get_data_dir(__file__) + "/cluster" + str(i)) type1 = sdk_client_fs.bundle_list(name="cluster_type_1") with allure.step('Check bundle list name and version'): assert len(type1) == 2 assert type1[0].name == "cluster_type_1" assert type1[1].name == "cluster_type_1" assert ((type1[0].version == "1.4" and type1[1].version == "1.5") or (type1[0].version == "1.5" and type1[1].version == "1.4"))
def test_that_check_empty_field_is(empty_fields, sdk_client_fs: ADCMClient): """Test upload bundles with empty fields""" bundle_path = utils.get_data_dir(__file__, "empty_states", empty_fields) sdk_client_fs.upload_from_fs(bundle_path) with allure.step("Check cluster bundle"): assert sdk_client_fs.bundle_list() is not None