def test_execute_method(self, mocked_requests, mocked_requests2): woql_client = WOQLClient("http://*****:*****@context"] = json_context requests.post.assert_called_once_with( "http://localhost:6363/woql/admin/myDBName/local/branch/master", headers={ "Authorization": "Basic YWRtaW46cm9vdA==", "content-type": "application/json", }, json={"query": mycon}, )
client.create_database(dbid, user, label=label, description=description) except Exception as E: error_obj = E.errorObj if "api:DatabaseAlreadyExists" == error_obj.get("api:error", {}).get("@type", None): print(f'Warning: Database "{dbid}" already exists!\n') else: raise (E) # Add the schema (there is no harm in adding repeatedly as it is idempotent) schema_query = WQ().woql_and(WQ().doctype( "scm:Widget").label("Widget").description("A widget").property( "sku", "xsd:string").label("sku").cardinality(1).property( "date_added", "xsd:dateTime").label("date_added").property( "category", "xsd:string").label("category")) schema_query.execute(client, "Adding schema") # Make the production branch production = "production" try: client.branch(production) except Exception as E: error_obj = E.errorObj if "api:BranchExistsError" == error_obj.get("api:error", {}).get("@type", None): print(f'Warning: Branch "{production}" already exists!\n') else: raise (E) # Return to the 'main' branch client.checkout('main')