# Path: yithlibraryserver/db.py
# DEFAULT_MONGODB_HOST = 'localhost'
# DEFAULT_MONGODB_PORT = 27017
# DEFAULT_MONGODB_NAME = 'yith-library'
# DEFAULT_MONGODB_URI = 'mongodb://%s:%d/%s' % (DEFAULT_MONGODB_HOST,
#                                               DEFAULT_MONGODB_PORT,
#                                               DEFAULT_MONGODB_NAME)
# class MongoDB(object):
#     def __init__(self, db_uri=DEFAULT_MONGODB_URI,
#                  connection_factory=pymongo.Connection):
#     def get_connection(self):
#     def get_database(self):
# def get_db(request):


import unittest
from yithlibraryserver import db
#
# You should have received a copy of the GNU Affero General Public License
# along with Yith Library Server.  If not, see <http://www.gnu.org/licenses/>.




class FakeDatabase(object):

    def __init__(self, name):
        self.name = name
        self.is_authenticated = False

    def authenticate(self, user, password):
        self.is_authenticated = True


class FakeConnection(object):

    def __init__(self, *args, **kwargs):
        self.args = args
        self.kwargs = kwargs

    def __getitem__(self, key):
        return FakeDatabase(key)


class MongoDBTests(unittest.TestCase):

    def test_uri(self):

# Path: yithlibraryserver/db.py
# DEFAULT_MONGODB_HOST = 'localhost'
# DEFAULT_MONGODB_PORT = 27017
# DEFAULT_MONGODB_NAME = 'yith-library'
# DEFAULT_MONGODB_URI = 'mongodb://%s:%d/%s' % (DEFAULT_MONGODB_HOST,
#                                               DEFAULT_MONGODB_PORT,
#                                               DEFAULT_MONGODB_NAME)
# class MongoDB(object):
#     def __init__(self, db_uri=DEFAULT_MONGODB_URI,
#                  connection_factory=pymongo.Connection):
#     def get_connection(self):
#     def get_database(self):
# def get_db(request):


# Path: yithlibraryserver/tests/test_db.py
import unittest
from yithlibraryserver import db

#
# You should have received a copy of the GNU Affero General Public License
# along with Yith Library Server.  If not, see <http://www.gnu.org/licenses/>.




class FakeDatabase(object):

    def __init__(self, name):
        self.name = name
        self.is_authenticated = False

    def authenticate(self, user, password):
        self.is_authenticated = True


class FakeConnection(object):

    def __init__(self, *args, **kwargs):
        self.args = args
        self.kwargs = kwargs

    def __getitem__(self, key):
        return FakeDatabase(key)


class MongoDBTests(unittest.TestCase):

    def test_uri(self):

        mdb = db.MongoDB(connection_factory=FakeConnection)