예제 #1
0
 def test_create_document(self):
     collection_name = "example"
     response = create(
         "collection", {
             "name":
             collection_name,
             "id_key":
             "name",
             "ordering":
             "ordering",
             "attributes": [{
                 "name": "a",
                 "type": "STRING"
             }, {
                 "name": "b",
                 "type": "STRING"
             }, {
                 "name": "c",
                 "type": "STRING"
             }]
         })
     response = create(
         collection_name, {
             "name": "1",
             "ordering": "2",
             "attributes": {
                 "a": "test1",
                 "b": "test2",
                 "c": "test3"
             }
         })
     self.assertEqual(response["name"], "1")
     self.assertIn("attributes", response)
예제 #2
0
 def test_create_index(self):
     collection_name = "example"
     response = create(
         "collection", {
             "name":
             collection_name,
             "id_key":
             "id",
             "ordering":
             "ordering",
             "attributes": [{
                 "name": "a",
                 "type": "STRING"
             }, {
                 "name": "b",
                 "type": "STRING"
             }, {
                 "name": "c",
                 "type": "STRING"
             }]
         })
     index = {
         "uid": str(uuid.uuid4()),
         "name": "index",
         "collection": {
             "id_key": "id",
             "name": collection_name
         },
         "conditions": ["a", "b"]
     }
     create("index", index)
예제 #3
0
 def test_create_http_signature_client_authorization(self):
     http_signature_client_authorization = {
         "type":
         "http_signature",
         "client_id":
         "testclientid",
         "public_key":
         "test-public-key",
         "client_scopes": [{
             "collection_name": "collection1",
             "scope_type": "GET"
         }]
     }
     response = create("client_authorization",
                       http_signature_client_authorization)
     print("{}".format(response))
예제 #4
0
 def test_create_collection(self):
     collection_name = "example"
     response = create(
         "collection", {
             "name":
             collection_name,
             "id_key":
             "id",
             "ordering":
             "ordering",
             "attributes": [{
                 "name": "a",
                 "type": "STRING"
             }, {
                 "name": "b",
                 "type": "STRING"
             }, {
                 "name": "c",
                 "type": "STRING"
             }]
         })
     self.assertEqual(response["name"], collection_name)