# Path: bibserver/dao.py
# def make_id(data):
# def init_db():
# def get_conn():
#     def __init__(self, **kwargs):
#     def id(self):
#     def version(self):
#     def save(self):
#     def delete(self):
#     def get(cls, id_):
#     def get_mapping(cls):
#     def get_facets_from_mapping(cls,mapping=False,prefix=''):
#     def upsert(cls, data, state=None):
#     def bulk_upsert(cls, dataset, state=None):
#     def delete_by_query(cls, query):
#     def query(cls, q='', terms=None, facet_fields=None, flt=False, default_operator='AND', **kwargs):
#     def raw_query(self, query_string):
#     def about(cls, id_):
#     def records(self):
#     def get_by_owner_coll(cls,owner,coll):
#     def delete(self):
#     def __len__(self):
#     def set_password(self, password):
#     def check_password(self, password):
#     def is_super(self):
#     def collections(self):
#     def notes(self):
#     def delete(self):
# class InvalidDAOIDException(Exception):
# class DomainObject(UserDict.IterableUserDict):
# class Record(DomainObject):
# class Note(DomainObject):
# class Collection(DomainObject):
# class Account(DomainObject, UserMixin):


import os
import json
from bibserver import dao
from bibserver.config import config


TESTDB = 'bibserver-test'

here = os.path.dirname(__file__)
fixtures_path = os.path.join(here, 'fixtures.json')
fixtures = json.load(open(fixtures_path))

config["ELASTIC_SEARCH_DB"] = TESTDB
dao.init_db()


class Fixtures(object):
    raw = fixtures

    @classmethod
    def create_account(cls):
        accountdict = dict(fixtures['accounts'][0])
        pw = accountdict['password_raw']
        del accountdict['password_raw']

# Path: bibserver/dao.py
# def make_id(data):
# def init_db():
# def get_conn():
#     def __init__(self, **kwargs):
#     def id(self):
#     def version(self):
#     def save(self):
#     def delete(self):
#     def get(cls, id_):
#     def get_mapping(cls):
#     def get_facets_from_mapping(cls,mapping=False,prefix=''):
#     def upsert(cls, data, state=None):
#     def bulk_upsert(cls, dataset, state=None):
#     def delete_by_query(cls, query):
#     def query(cls, q='', terms=None, facet_fields=None, flt=False, default_operator='AND', **kwargs):
#     def raw_query(self, query_string):
#     def about(cls, id_):
#     def records(self):
#     def get_by_owner_coll(cls,owner,coll):
#     def delete(self):
#     def __len__(self):
#     def set_password(self, password):
#     def check_password(self, password):
#     def is_super(self):
#     def collections(self):
#     def notes(self):
#     def delete(self):
# class InvalidDAOIDException(Exception):
# class DomainObject(UserDict.IterableUserDict):
# class Record(DomainObject):
# class Note(DomainObject):
# class Collection(DomainObject):
# class Account(DomainObject, UserMixin):


# Path: test/base.py
import os
import json
from bibserver import dao
from bibserver.config import config



TESTDB = 'bibserver-test'

here = os.path.dirname(__file__)
fixtures_path = os.path.join(here, 'fixtures.json')
fixtures = json.load(open(fixtures_path))

config["ELASTIC_SEARCH_DB"] = TESTDB
dao.init_db()


class Fixtures(object):
    raw = fixtures

    @classmethod
    def create_account(cls):
        accountdict = dict(fixtures['accounts'][0])
        pw = accountdict['password_raw']
        del accountdict['password_raw']

        cls.account = dao.Account(**accountdict)