def test_create_provider(db_session, providers): provider = db_session.query(CloudProvider).filter_by( name="provider_c").first() assert provider == None adm.create_provider(db_session, "provider_c", "cleversafe", "storage") info = db_session.query(CloudProvider).filter_by(name="provider_c").first() assert info.name == "provider_c" assert info.backend == "cleversafe" assert info.service == "storage"
def create_cloud_provider(providername): """ Create a cloud provider. Returns a json object """ backend_name = request.get_json().get("backend") service_name = request.get_json().get("service") response = jsonify( admin.create_provider(current_session, providername, backend=backend_name, service=service_name)) return response
def test_create_provider_that_already_exists(db_session, providers): provider = db_session.query(CloudProvider).filter_by( name="provider_a").first() assert provider != None with pytest.raises(UserError): adm.create_provider(db_session, "provider_a", "cleversafe", "storage")