Beispiel #1
0
 def test_database_properties(self):
     db = self.arango.database("_system")
     self.assertEqual(db.name, "_system")
     self.assertTrue(isinstance(db.properties, dict))
     self.assertTrue(is_string(db.id))
     self.assertTrue(is_string(db.path))
     self.assertEqual(db.is_system, True)
Beispiel #2
0
 def test_database_properties(self):
     db = self.arango.database("_system")
     self.assertEqual(db.name, "_system")
     self.assertTrue(isinstance(db.properties, dict))
     self.assertTrue(is_string(db.id))
     self.assertTrue(is_string(db.path))
     self.assertEqual(db.is_system, True)
Beispiel #3
0
 def patch(self, path, data=None, params=None, headers=None):
     """Execute an HTTP PATCH method."""
     return self.client.patch(
         url=self.url_prefix + path,
         data=data if is_string(data) else json.dumps(data),
         params=params,
         headers=headers,
         auth=(self.username, self.password)
     )
Beispiel #4
0
    def put(self, path, data=None, params=None, headers=None):
        """Call a PUT method in ArangoDB's REST API.

        :param path: the API path (e.g. '/_api/version')
        :type path: str
        :param data: the request payload
        :type data: str or dict or None
        :param params: the request parameters
        :type params: dict or None
        :param headers: the request headers
        :type headers: dict or None
        :returns: the ArangoDB http response
        :rtype: arango.response.Response
        """
        return self.client.put(
            url=self.url_prefix + path,
            data=data if is_string(data) else json.dumps(data),
            params=params,
            headers=headers,
            auth=(self.username, self.password)
        )
 def test_collection_create_with_config(self):
     # Create a new collection with custom defined properties
     col_name = get_next_col_name(self.db)
     col = self.db.create_collection(
         name=col_name,
         wait_for_sync=True,
         do_compact=False,
         journal_size=7774208,
         is_system=False,
         is_volatile=False,
         key_generator_type="autoincrement",
         allow_user_keys=False,
         key_increment=9,
         key_offset=100,
         is_edge=True,
         number_of_shards=2,
         shard_keys=["test_attr"],
     )
     # Ensure that the new collection's properties are set correctly
     self.assertEqual(col.name, col_name)
     self.assertTrue(col.revision, "0")
     self.assertEqual(col.status, "loaded")
     self.assertEqual(col.journal_size, 7774208)
     self.assertEqual(col.checksum(), 0)
     self.assertEqual(
         col.key_options,
         {
             "allow_user_keys": False,
             "increment": 9,
             "offset": 100,
             "type": "autoincrement"
         }
     )
     self.assertFalse(col.is_system)
     self.assertFalse(col.is_volatile)
     self.assertFalse(col.do_compact)
     self.assertTrue(col.wait_for_sync)
     self.assertTrue(col.is_edge)
     self.assertTrue(is_string(col.id))
     self.assertTrue(isinstance(col.figures, dict))