def test_upload_plugin_failed(artifact_file, artifact_content, fake_client): user = '******' password = '******' with pytest.raises(exceptions.HttpError) as err_info: upload.upload(fake_client.engine, user, artifact_file, password) error = err_info.value.error message = err_info.value.message assert err_info.value.status_code == 200 assert error['details'] == ('The schema "repositorySchema" in the' ' "DiscoveryDefinition" cannot be updated' ' because there exist objects that conform' ' to the original schema.') assert error['action'] == ('Delete the following objects and try' ' again: db_centos75_157_2,' 'db_centos75_157_1,db_centos75_157_0') assert message == ('API request failed with HTTP Status 200' '\nDetails: The schema "repositorySchema" in the' ' "DiscoveryDefinition" cannot be updated because' ' there exist objects that conform to the original' ' schema.' '\nAction: Delete the following objects and try' ' again: db_centos75_157_2,db_centos75_157_1,' 'db_centos75_157_0') # Make sure the file was not uploaded to the client. assert ('upload_artifact.json' not in fake_client.uploaded_files)
def test_upload_api_incorrect(artifact_file, fake_client): user = '******' password = '******' with pytest.raises(exceptions.HttpError) as err_info: upload.upload(fake_client.engine, user, artifact_file, password) error = err_info.value.error message = err_info.value.message assert err_info.value.status_code == 200 assert error['details'] == 'Invalid API version.' assert error['action'] == ('Change the API version to one supported' ' by your version of the Delphix Engine.' ' Review the Release Notes for your' ' Delphix Engine version to determine which' ' API version is supported.') assert message == ('API request failed with HTTP Status 200' '\nDetails: Invalid API version.' '\nAction: Change the API version to one supported' ' by your version of the Delphix Engine.' ' Review the Release Notes for your' ' Delphix Engine version to determine which' ' API version is supported.') # Make sure the file was not uploaded to the client. assert ('upload_artifact.json' not in fake_client.uploaded_files)
def test_upload_plugin_failed(artifact_file, artifact_content, fake_client): user = "******" password = "******" with pytest.raises(exceptions.HttpError) as err_info: upload.upload(fake_client.engine, user, artifact_file, password) error = err_info.value.error message = err_info.value.message assert err_info.value.status_code == 200 assert error["details"] == ('The schema "repositorySchema" in the' ' "DiscoveryDefinition" cannot be updated' " because there exist objects that conform" " to the original schema.") assert error["action"] == ("Delete the following objects and try" " again: db_centos75_157_2," "db_centos75_157_1,db_centos75_157_0") assert message == ("API request failed with HTTP Status 200" '\nDetails: The schema "repositorySchema" in the' ' "DiscoveryDefinition" cannot be updated because' " there exist objects that conform to the original" " schema." "\nAction: Delete the following objects and try" " again: db_centos75_157_2,db_centos75_157_1," "db_centos75_157_0") # Make sure the file was not uploaded to the client. assert "upload_artifact.json" not in fake_client.uploaded_files
def test_upload_api_incorrect(artifact_file, fake_client): user = "******" password = "******" with pytest.raises(exceptions.HttpError) as err_info: upload.upload(fake_client.engine, user, artifact_file, password) error = err_info.value.error message = err_info.value.message assert err_info.value.status_code == 200 assert error["details"] == "Invalid API version." assert error["action"] == ("Change the API version to one supported" " by your version of the Delphix Engine." " Review the Release Notes for your" " Delphix Engine version to determine which" " API version is supported.") assert message == ("API request failed with HTTP Status 200" "\nDetails: Invalid API version." "\nAction: Change the API version to one supported" " by your version of the Delphix Engine." " Review the Release Notes for your" " Delphix Engine version to determine which" " API version is supported.") # Make sure the file was not uploaded to the client. assert "upload_artifact.json" not in fake_client.uploaded_files
def upload(engine, user, upload_artifact, password): """ Upload the generated upload artifact (the plugin JSON file) that was built to a target Delphix Engine. Note that the upload artifact should be the file created after running the build command and will fail if it's not readable or valid. """ with command_error_handler(): upload_internal.upload(engine, user, upload_artifact, password)
def test_upload_success(artifact_file, artifact_content, fake_client): user = "******" password = "******" upload.upload(fake_client.engine, user, artifact_file, password) # Make sure that the fake client was passed in the correct contents. assert fake_client.uploaded_files["artifact.json"] == artifact_content
def test_upload_success(artifact_file, artifact_content, fake_client): user = '******' password = '******' upload.upload(fake_client.engine, user, artifact_file, password) # Make sure that the fake client was passed in the correct contents. assert ( fake_client.uploaded_files['artifact.json'] == artifact_content)
def test_upload_no_file(fake_client, artifact_file): user = '******' password = '******' with pytest.raises(exceptions.UserError) as err_info: upload.upload(fake_client.engine, user, artifact_file, password) message = err_info.value.message assert message == ("Unable to read upload artifact file" " '/not/a/real/file/upload_artifact.json'" "\nError code: 2. Error message: ENOENT") # Make sure the file was not uploaded to the client. assert ('upload_artifact.json' not in fake_client.uploaded_files)
def test_upload_file_not_json(artifact_file, fake_client): user = '******' password = '******' with pytest.raises(exceptions.UserError) as err_info: upload.upload(fake_client.engine, user, artifact_file, password) message = err_info.value.message assert message == ( 'Upload failed because the upload artifact was not a' ' valid json file. Verify the file was built using' ' the delphix build command.') # Make sure the file was not uploaded to the client. assert ('upload_artifact.json' not in fake_client.uploaded_files)
def test_upload_password_incorrect(artifact_file, artifact_content, fake_client): user = '******' password = '******' with pytest.raises(exceptions.HttpError) as err_info: upload.upload(fake_client.engine, user, artifact_file, password) error = err_info.value.error message = err_info.value.message assert err_info.value.status_code == 401 assert error['details'] == 'Invalid username or password.' assert error['action'] == 'Try with a different set of credentials.' assert message == ( 'API request failed with HTTP Status 401' '\nDetails: Invalid username or password.' '\nAction: Try with a different set of credentials.') # Make sure the file was not uploaded to the client. assert ('upload_artifact.json' not in fake_client.uploaded_files)
def test_upload_password_incorrect(artifact_file, artifact_content, fake_client): user = "******" password = "******" with pytest.raises(exceptions.HttpError) as err_info: upload.upload(fake_client.engine, user, artifact_file, password) error = err_info.value.error message = err_info.value.message assert err_info.value.status_code == 401 assert error["details"] == "Invalid username or password." assert error["action"] == "Try with a different set of credentials." assert message == ( "API request failed with HTTP Status 401" "\nDetails: Invalid username or password." "\nAction: Try with a different set of credentials.") # Make sure the file was not uploaded to the client. assert "upload_artifact.json" not in fake_client.uploaded_files