# Path: arangodb/api.py
# class Database(object):
#     @classmethod
#     def create(cls, name, users=None):
#         """
#             Creates database and sets itself as the active database.
# 
#             :param name Database name
# 
#             :returns Database
#         """
# 
#         api = Client.instance().api
# 
#         database_data = {
#             'name': name,
#             'active': True,
#         }
# 
#         if isinstance(users, list) or isinstance(users, tuple):
#             database_data['users'] = users
# 
#         data = api.database.post(data=database_data)
# 
#         db = Database(
#             name=name,
#             api=api,
#             kwargs=data
#         )
# 
#         Client.instance().set_database(name=name)
# 
#         return db
# 
#     @classmethod
#     def get_all(cls):
#         """
#             Returns an array with all databases
# 
#             :returns Database list
#         """
# 
#         api = Client.instance().api
# 
#         data = api.database.get()
# 
#         database_names = data['result']
#         databases = []
# 
#         for name in database_names:
#             db = Database(name=name, api=api)
#             databases.append(db)
# 
#         return databases
# 
# 
#     @classmethod
#     def remove(cls, name):
#         """
#             Destroys the database.
#         """
# 
#         client = Client.instance()
# 
#         new_current_database = None
# 
#         if client.database != name:
#             new_current_database = name
# 
#         # Deletions are only possible from the system database
#         client.set_database(name=SYSTEM_DATABASE)
# 
#         api = client.api
#         api.database(name).delete()
# 
#         if new_current_database:
#             client.set_database(name=new_current_database)
# 
# 
#     def __init__(self, name, api, **kwargs):
#         """
#         """
# 
#         self.name = name
#         self.api = api
# 
#     def create_collection(self, name, type=2):
#         """
#             Shortcut to create a collection
# 
#             :param name Collection name
#             :param type Collection type (2 = document / 3 = edge)
# 
#             :returns Collection
#         """
# 
#         return Collection.create(name=name, database=self.name, type=type)


import unittest
from arangodb.api import Database



class DatabaseTestCase(unittest.TestCase):
    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_create_and_delete_database(self):

        database_name = 'test_foo_123'


# Path: arangodb/api.py
# class Database(object):
#     @classmethod
#     def create(cls, name, users=None):
#         """
#             Creates database and sets itself as the active database.
# 
#             :param name Database name
# 
#             :returns Database
#         """
# 
#         api = Client.instance().api
# 
#         database_data = {
#             'name': name,
#             'active': True,
#         }
# 
#         if isinstance(users, list) or isinstance(users, tuple):
#             database_data['users'] = users
# 
#         data = api.database.post(data=database_data)
# 
#         db = Database(
#             name=name,
#             api=api,
#             kwargs=data
#         )
# 
#         Client.instance().set_database(name=name)
# 
#         return db
# 
#     @classmethod
#     def get_all(cls):
#         """
#             Returns an array with all databases
# 
#             :returns Database list
#         """
# 
#         api = Client.instance().api
# 
#         data = api.database.get()
# 
#         database_names = data['result']
#         databases = []
# 
#         for name in database_names:
#             db = Database(name=name, api=api)
#             databases.append(db)
# 
#         return databases
# 
# 
#     @classmethod
#     def remove(cls, name):
#         """
#             Destroys the database.
#         """
# 
#         client = Client.instance()
# 
#         new_current_database = None
# 
#         if client.database != name:
#             new_current_database = name
# 
#         # Deletions are only possible from the system database
#         client.set_database(name=SYSTEM_DATABASE)
# 
#         api = client.api
#         api.database(name).delete()
# 
#         if new_current_database:
#             client.set_database(name=new_current_database)
# 
# 
#     def __init__(self, name, api, **kwargs):
#         """
#         """
# 
#         self.name = name
#         self.api = api
# 
#     def create_collection(self, name, type=2):
#         """
#             Shortcut to create a collection
# 
#             :param name Collection name
#             :param type Collection type (2 = document / 3 = edge)
# 
#             :returns Collection
#         """
# 
#         return Collection.create(name=name, database=self.name, type=type)


# Path: arangodb/tests/api/database.py
import unittest
from arangodb.api import Database




class DatabaseTestCase(unittest.TestCase):
    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_create_and_delete_database(self):

        database_name = 'test_foo_123'


        db = Database.create(name=database_name)