def setUp(self): MangroveTestCase.setUp(self) database_name = uniq('feed-mangrove-test') self.feed_manager = get_db_manager('http://localhost:6984/', database_name) _delete_db_and_remove_db_manager(self.feed_manager) self.feed_manager = get_db_manager('http://localhost:6984/', database_name) self.owner_uid = self.create_reporter().id TestData(self.manager)
def setUpClass(cls): cls.manager = get_db_manager('http://localhost:5984/', 'mangrove-test') _delete_db_and_remove_db_manager(cls.manager) cls.manager = get_db_manager('http://localhost:5984/', 'mangrove-test') initializer._create_views(cls.manager) cls.org_id = 'SLX364903' cls._prepare_sms_data_senders() cls.test_ds_id = get_by_short_code_include_voided( cls.manager, "test", REPORTER_ENTITY_TYPE).id deleted_ds = get_by_short_code_include_voided(cls.manager, "del1", REPORTER_ENTITY_TYPE) deleted_ds.void() cls.deleted_ds_id = deleted_ds.id
def _set_data_for_table(self): if hasattr(self, '_data_for_table'): return dbm = get_db_manager( server=settings.MANGROVE_DATABASES['default']['SERVER'], database=settings.MANGROVE_DATABASES['default']['DATABASE']) sector_to_facility = { 'health': 'Health Clinic', 'education': 'School', 'water': 'Water Point' } facility_type = sector_to_facility[self._sector] facilities = get_entities_in(dbm, self._region_thing.entity.location_path, facility_type) slugs = [header.slug for header in self._headers] result = [] for facility in facilities: data = facility.get_all_data() times = data.keys() times.sort() # get the latest data latest_data = data[times[-1]] self._add_calculated_sector_indicators(latest_data) d = dict([(slug, latest_data[slug]) for slug in slugs]) d.update({ 'sector': self._sector, 'facility_type': facility_type, 'latlng': facility.geometry['coordinates'], 'img_id': latest_data['photo'] }) result.append(d) self._data_for_table = result
def migrate(database): try: log_statement("database: %s" % database) dbm = get_db_manager(SERVER, database=database) revid_map = revsion_map(database, dbm) for old_rev, values in revid_map.iteritems(): survey_response_docs = dbm.database.query( map_survey_response_by_form_model_revision % (values[1], old_rev)) for survey_response_doc in survey_response_docs: survey_response = SurveyResponse.new_from_doc( dbm=dbm, doc=SurveyResponse.__document_class__.wrap( survey_response_doc['value'])) log_statement("Changing revision on:%s from:%s to:%s" % (survey_response.id, survey_response.form_model_revision, values[0])) survey_response.form_model_revision = values[0] survey_response.save() log_statement("Completed Database : %s" % database) mark_as_completed(database) log_file.writelines( "\n=======================================================\n") except Exception: log_statement("Failed Database : %s" % database) traceback.print_exc(file=log_file)
def load_all_managers(): managers = [] for org in OrganizationSetting.objects.all(): db = org.document_store manager = get_db_manager(server=settings.COUCH_DB_SERVER, database=db) managers.append(manager) return managers
def setUpClass(cls): EntityDocument.registered_functions = [] database_name = uniq('mangrove-test') cls.manager = get_db_manager('http://localhost:5984/', database_name) _delete_db_and_remove_db_manager(cls.manager) cls.manager = get_db_manager('http://localhost:5984/', database_name) initializer._create_views(cls.manager) cls.org_id = 'SLX364903' cls._prepare_sms_data_senders() cls.test_ds_id = get_by_short_code_include_voided( cls.manager, "test", REPORTER_ENTITY_TYPE).id deleted_ds = get_by_short_code_include_voided(cls.manager, "del1", REPORTER_ENTITY_TYPE) deleted_ds.void() cls.deleted_ds_id = deleted_ds.id
def get_db_manager_for(org_tel_number): try: organization_settings = OrganizationSetting.objects.get(sms_tel_number=org_tel_number) except ObjectDoesNotExist: raise UnknownOrganization(org_tel_number) db = organization_settings.document_store return get_db_manager(server=settings.COUCH_DB_SERVER, database=db)
def setUpClass(cls): cls.manager = get_db_manager('http://localhost:5984/', uniq('mangrove-test')) initializer._create_views(cls.manager) cls.entity_type = ["HealthFacility", "Clinic"] safe_define_type(cls.manager, ["HealthFacility", "Clinic"]) cls._create_form_model()
def migrate(dbs): visited_dbs, success_dbs, failed_dbs = [], [], [] for db in dbs: try: dbm = get_db_manager(server=SERVER, database=db) visited_dbs.append(db) sync_views(dbm) subject_short_codes_dict = dict(find_subject_short_code(dbm)) if not subject_short_codes_dict: remove_db_manager(dbm) continue entity_question_codes_dict = dict(find_entity_question_code(dbm)) output.writelines("\nMigration database [%s]" % db) correct_submissions(dbm, subject_short_codes_dict, entity_question_codes_dict) remove_db_manager(dbm) success_dbs.append(db) except Exception as e: failed_dbs.append(db) print e pass output.close() return visited_dbs, success_dbs, failed_dbs
def migrate_db(database): log_statement('\nStart migration on database : %s \n' % database) try: manager = get_db_manager(server=SERVER, database=database, credentials=credentials) questionnaire_form_model_docs = manager.database.query( map_form_model_questionnaire) mark_as_completed(database) for form_model_doc in questionnaire_form_model_docs: form_model = get_form_model(manager, form_model_doc) log_statement( "Process on :form_model document_id : %s , form code : %s" % (form_model.id, form_model.form_code)) if any_field_is_optional_in(form_model): migrate_form_model(form_model) log_statement("Form Model updated :%s %s" % (database, form_model.form_code)) log_statement( "End process on :form_model document_id : %s , form code : %s" % (form_model.id, form_model.form_code)) log_statement('\nEnd migration on database : %s\n' % database) except Exception as e: log_statement('error:%s:%s\n' % (e.message, database)) traceback.print_exc(file=log_file)
def _set_data_for_table(self): if hasattr(self, '_data_for_table'): return dbm = get_db_manager( server=settings.MANGROVE_DATABASES['default']['SERVER'], database=settings.MANGROVE_DATABASES['default']['DATABASE']) sector_to_facility = { 'health': 'Health Clinic', 'education': 'School', 'water': 'Water Point' } facility_type = sector_to_facility[self._sector] facilities = get_entities_in(dbm, self._region_thing.entity.location_path, facility_type) slugs = [header.slug for header in self._headers] result = [] for facility in facilities: data = facility.get_all_data() times = data.keys() times.sort() # get the latest data latest_data = data[times[-1]] self._add_calculated_sector_indicators(latest_data) d = dict([(slug, latest_data[slug]) for slug in slugs]) d.update( { 'sector': self._sector, 'facility_type': facility_type, 'latlng': facility.geometry['coordinates'], 'img_id': latest_data['photo'] } ) result.append(d) self._data_for_table = result
def setUpClass(cls): FormModelDocument.registered_functions = [] cls.db_name = uniq('mangrove-test') cls.manager = get_db_manager('http://localhost:5984/', cls.db_name) initializer._create_views(cls.manager) create_views(cls.manager) question1 = UniqueIdField(unique_id_type='clinic', name="entity_question", code="ID", label="What is associated entity") question2 = TextField(name="question1_Name", code="Q1", label="What is your name", defaultValue="some default value", constraints=[TextLengthConstraint(5, 10)]) cls.project1 = Project(dbm=cls.manager, name=project1_name, goals="Testing", devices=['web'], form_code="abc", fields=[question1, question2]) cls.project1_id = cls.project1.save() cls.project2 = Project(dbm=cls.manager, name=project2_name, goals="Testing", devices=['web'], form_code="def", fields=[question1, question2]) cls.project2_id = cls.project2.save()
def get_database_manager_for_user(user): profile = user.get_profile() organization = Organization.objects.get(org_id=profile.org_id) organization_settings = OrganizationSetting.objects.get( organization=organization) db = organization_settings.document_store return get_db_manager(server=settings.COUCH_DB_SERVER, database=db)
def add_eid_field_for_survey_response_with_missing_eid_field(db_name): logger = logging.getLogger(db_name) logger.info('Starting Migration') # dbm = get_db_manager(db_name) dbm = get_db_manager(server='http://178.79.161.90:5984', database=db_name) inconsistent_survey_response_list = _get_survey_responses_with_no_eid( dbm, logger) for survey_response in inconsistent_survey_response_list: if survey_response.owner_uid: # data_sender = Entity.get(dbm, survey_response.owner_uid) # survey_response.values['eid'] = data_sender.short_code # logger.info("Migrated survey response: %s" % survey_response.uuid) logger.warning("survey_rsponse_id: %s" % survey_response.uuid) logger.warning("form_model_id: %s" % survey_response.form_code) else: logger.warning( "Missing owner id for survey_response: %s, form_code: %s" % (survey_response.uuid, survey_response.form_code)) # logger.info("Number of survey responses migrated: %s" % len(inconsistent_survey_response_list)) length_of_survey_response_with_no_eid = len( inconsistent_survey_response_list) org_id = OrganizationSetting.objects.get( document_store=dbm.database_name).organization_id if length_of_survey_response_with_no_eid: logger.info("Number of incorrect survey responses: %s" % length_of_survey_response_with_no_eid)
def setUp(self): self.dbm = get_db_manager(database='mangrove-test') self._create_entities() self.player = SMSPlayer(self.dbm, SubmissionHandler(self.dbm)) self.transport = TransportInfo(transport="sms", source="1234", destination="5678") initializer.run(self.dbm)
def get_db_manager_for(org_tel_number): try: organization_settings = OrganizationSetting.objects.get( sms_tel_number=org_tel_number) except ObjectDoesNotExist: raise UnknownOrganization(org_tel_number) db = organization_settings.document_store return get_db_manager(server=settings.COUCH_DB_SERVER, database=db)
def setUp(self): self.dbm = get_db_manager(database='mangrove-test') define_type(self.dbm, ["Reporter"]) reporter = Entity(self.dbm, entity_type=["Reporter"], location=["Pune", "India"], short_code="REPX") reporter.save() reporter = Entity(self.dbm, entity_type=["Reporter"], location=["Pune", "India"], short_code="REP1") reporter.save() reporter = Entity(self.dbm, entity_type=["Reporter"], location=["Pune", "India"], short_code="REP2") reporter.save()
def test_should_create_database_if_it_does_not_exist(self): _delete_db_and_remove_db_manager(self.database_manager) server = self.server database = self.database_name self.database_manager = get_db_manager(server, database) self.assertTrue(self.database_manager.url == server) self.assertTrue(self.database_manager.database_name == database) self.assertTrue(self.database_manager.server) self.assertTrue(self.database_manager.database)
def test_should_create_organization_setting_with_document_store_on_create_organization( self): c = Client() reg_post = dict( email="*****@*****.**", first_name="first_name", last_name="last", organization_addressline1="x", organization_addressline2="y", organization_city="city", organization_country="country", organization_name="TEST_ORG_NAME", organization_office_phone="", organization_sector="PublicHealth", organization_state="state", organization_website="", organization_zipcode="zip", password1="a", password2="a", title="", ) response = c.post('/register/', reg_post) self.assertIsNotNone(response) user = User.objects.get(email='*****@*****.**') profile = RegistrationProfile.objects.get(user=user) activation_key = profile.activation_key response = c.post('/activate/%s/' % activation_key) self.assertIsNotNone(response) organization = Organization.objects.get(name="TEST_ORG_NAME") organization_settings = OrganizationSetting.objects.get( organization=organization) organization_db_name = organization_settings.document_store expected_org_db_name = ("hni_test_org_name_%s" % (organization.org_id, )).lower() self.assertEqual(expected_org_db_name, organization_db_name) couch_server = couchdb.client.Server(settings.COUCH_DB_SERVER) org_db = None try: org_db = couch_server[organization_db_name] except Exception: self.fail("Organization database %s not created" % (organization_db_name, )) self.assertIsNotNone(org_db) manager = get_db_manager(server=couch_server, database=organization_db_name) test_reporter = reporter.find_reporter_entity( manager, TEST_REPORTER_MOBILE_NUMBER) self.assertIsNotNone(test_reporter) #clean up the org db del couch_server[organization_db_name]
def test_should_create_database_if_it_does_not_exist(self): _delete_db_and_remove_db_manager(self.database_manager) server = 'http://localhost:5984/' database = 'mangrove-test' self.database_manager = get_db_manager(server, database) self.assertTrue(self.database_manager.url == server) self.assertTrue(self.database_manager.database_name == database) self.assertTrue(self.database_manager.server) self.assertTrue(self.database_manager.database)
def setUp(self): self.dbm = get_db_manager(database='mangrove-test') self.meds_type = create_data_dict(dbm=self.dbm, name='Medicines', slug='meds', primitive_type='number', description='Number of medications') self.beds_type = create_data_dict(dbm=self.dbm, name='Beds', slug='beds', primitive_type='number', description='Number of beds') self.director_type = create_data_dict(dbm=self.dbm, name='Director', slug='dir', primitive_type='string', description='Name of director') self.patients_type = create_data_dict(dbm=self.dbm, name='Patients', slug='patients', primitive_type='number', description='Patient Count')
def setUp(self): self.dbm = get_db_manager(database='mangrove-test') self.csv_data = """ "form_code","t","n","l","g","d","s","m" "REG","reporter","Aàman Farafangana ","Farafangana ","-21.8 46.8333","This is a Clinic in near to Farafangana ",,987654328 "REG","reporter","Reporter1 Fianarantsoa ","mahajanga ","-20.45 45.1","C'est une clinique à Fianarantsoa",,987654329 "REG","reporter","Reporter2 Maintirano ","Maintirano ","-18.05 44.0333","This is a reporter in Maintirano ",,987654333 "REG","reporter","Reporter3 Mananjary ","Mananjary ","-21.2 48.3667","This is a reporter in Mananjary ",,987654334 """ initializer.run(self.dbm)
def get_DS_with_ca(dbname): dbm = get_db_manager(server="http://*****:*****@172.18.9.6:5984", database=dbname, credentials=('admin', 'admin')) all_ds = get_all_entities(dbm, ['reporter']) for ds in all_ds: if 'short_code' in ds.data.keys(): short_code = ds.data['short_code']['value'] if re.search('[A-Z]', short_code): print 'short_code is :' + short_code print 'database is :' + dbname
def setUp(self): self.dbm = get_db_manager(database='mangrove-test') create_views(self.dbm) self.project1 = Project(name="Test1", goals="Testing", project_type="Survey", entity_type="Clinic", devices=['web']) self.project1_id = self.project1.save(self.dbm) self.project2 = Project(name="Test2", goals="Testing", project_type="Survey", entity_type="Clinic", devices=['web']) self.project2_id = self.project2.save(self.dbm) self._create_form_model_for_project(self.project1)
def setUp(self): self.database = "hni_testorg_slx364903" self.form_code = "cli001" self.dbm = get_db_manager(settings.COUCH_DB_SERVER, database=self.database) self.form = form_model.get_form_model_by_code(self.dbm, self.form_code) self.entity_question_code = self.form.entity_question.code self.old_short_code, self.new_short_code = self.change_submissions( self.dbm, self.form_code, self.entity_question_code) self.change_subject(self.dbm, self.form, self.old_short_code, self.new_short_code)
def create_db(name): dbm = get_db_manager('http://localhost:5984/', name) views = [] for v in view_js.keys(): funcs = view_js[v] map = (funcs['map'] if 'map' in funcs else None) reduce = (funcs['reduce'] if 'reduce' in funcs else None) views.append(ViewDefinition(v, v, map, reduce)) ViewDefinition.sync_many(dbm.database, views) return dbm
def find_subject(): result = {} managers = all_db_names() for manager_name in managers: logger.info(manager_name) manager = get_db_manager(server=db_server, database=manager_name) database_query = manager.database.query(map_fun_project_docs) if database_query: result[manager.database_name]=database_query logger.info("**********************pro found**********************" + manager_name)
def find_subject(): result = {} managers = all_db_names() for manager_name in managers: logger.info(manager_name) manager = get_db_manager(server=db_server, database=manager_name,credentials=settings.COUCHDBMAIN_CREDENTIALS) database_query = manager.database.query(map_fun_project_docs) if database_query: result[manager.database_name]=database_query logger.info("**********************pro found**********************" + manager_name)
def test_should_create_organization_setting_with_document_store_on_create_organization(self): c = Client() reg_post = dict( email="*****@*****.**", first_name="first_name", last_name="last", organization_addressline1="x", organization_addressline2="y", organization_city="city", organization_country="country", organization_name="TEST_ORG_NAME", organization_office_phone="", organization_sector="PublicHealth", organization_state="state", organization_website="", organization_zipcode="zip", password1="a", password2="a", title="", ) response = c.post('/register/', reg_post) self.assertIsNotNone(response) user = User.objects.get(email='*****@*****.**') profile = RegistrationProfile.objects.get(user=user) activation_key = profile.activation_key response = c.post('/activate/%s/' % activation_key) self.assertIsNotNone(response) organization = Organization.objects.get(name="TEST_ORG_NAME") organization_settings = OrganizationSetting.objects.get(organization=organization) organization_db_name = organization_settings.document_store expected_org_db_name = ("hni_test_org_name_%s" % (organization.org_id,)).lower() self.assertEqual(expected_org_db_name, organization_db_name) couch_server = couchdb.client.Server(settings.COUCH_DB_SERVER) org_db = None try: org_db = couch_server[organization_db_name] except Exception: self.fail("Organization database %s not created" % (organization_db_name,)) self.assertIsNotNone(org_db) manager = get_db_manager(server=couch_server, database=organization_db_name) test_reporter = reporter.find_reporter_entity(manager, TEST_REPORTER_MOBILE_NUMBER) self.assertIsNotNone(test_reporter) #clean up the org db del couch_server[organization_db_name]
def migrate_db(db): try: mark_as_completed(db) manager = get_db_manager(server=SERVER, database=db) log_statement("Database: %s" % manager.database) form_model = get_form_model_by_code(manager, ENTITY_DELETION_FORM_CODE) log_statement("FormModel:%s" % form_model.id, manager.database) for field in form_model.fields: if field.code == 's': field.set_constraints([]) form_model.save() except Exception as e: log_statement(":Error", db) traceback.print_exc(file=log_file)
def delete_redundant_language_setting_from_form(): dbs = all_db_names(db_server) for db_name in dbs: try: logger.info(db_name) print db_name manager = get_db_manager(server=db_server, database=db_name) delete_language_setting_for_form_models(manager) remove_db_manager(manager) except Exception as e: print("******************************************", db_name) print e print("***************************************************")
def setUp(self): self.dbm = get_db_manager(database='mangrove-test') initializer.run(self.dbm) define_type(self.dbm, ["dog"]) self.entity_type = ["healthfacility", "clinic"] define_type(self.dbm, self.entity_type) self.name_type = DataDictType(self.dbm, name='Name', slug='name', primitive_type='string') self.telephone_number_type = DataDictType(self.dbm, name='telephone_number', slug='telephone_number', primitive_type='string') self.entity_id_type = DataDictType(self.dbm, name='Entity Id Type', slug='entity_id', primitive_type='string') self.stock_type = DataDictType(self.dbm, name='Stock Type', slug='stock', primitive_type='integer') self.color_type = DataDictType(self.dbm, name='Color Type', slug='color', primitive_type='string') self.name_type.save() self.telephone_number_type.save() self.stock_type.save() self.color_type.save() self.entity = create_entity(self.dbm, entity_type=self.entity_type, location=["India", "Pune"], aggregation_paths=None, short_code="cli1", ) self.data_record_id = self.entity.add_data(data=[("Name", "Ruby", self.name_type)], submission=dict(submission_id="1")) self.reporter = create_entity(self.dbm, entity_type=["reporter"], location=["India", "Pune"], aggregation_paths=None, short_code="rep1", ) self.reporter.add_data(data=[(MOBILE_NUMBER_FIELD, '1234', self.telephone_number_type), (NAME_FIELD, "Test_reporter", self.name_type)], submission=dict(submission_id="2")) question1 = TextField(name="entity_question", code="EID", label="What is associated entity", language="eng", entity_question_flag=True, ddtype=self.entity_id_type) question2 = TextField(name="Name", code="NAME", label="Clinic Name", defaultValue="some default value", language="eng", length=TextConstraint(4, 15), ddtype=self.name_type) question3 = IntegerField(name="Arv stock", code="ARV", label="ARV Stock", range=NumericConstraint(min=15, max=120), ddtype=self.stock_type) question4 = SelectField(name="Color", code="COL", label="Color", options=[("RED", 1), ("YELLOW", 2)], ddtype=self.color_type) self.form_model = FormModel(self.dbm, entity_type=self.entity_type, name="aids", label="Aids form_model", form_code="clinic", type='survey', fields=[question1, question2, question3]) self.form_model.add_field(question4) self.form_model__id = self.form_model.save() self.submission_handler = SubmissionHandler(self.dbm) self.sms_player = SMSPlayer(self.dbm, self.submission_handler, LocationTree())
def create_org_database(sender, user, request, **kwargs): from datawinners.initializer import run profile = user.get_profile() org = Organization.objects.get(org_id=profile.org_id) if org is None: return None org_settings = OrganizationSetting.objects.get(organization=org) db_name = org_settings.document_store # Explicitly create the new database. Should fail it db already exists. server = couchdb.client.Server(datawinners.settings.COUCH_DB_SERVER) server.create(db_name) manager = get_db_manager(server=datawinners.settings.COUCH_DB_SERVER, database=db_name) assert manager, "Could not create database manager for %s " % (db_name,) run(manager)
def create_org_database(sender, user, request, **kwargs): from datawinners.initializer import run profile = user.get_profile() org = Organization.objects.get(org_id=profile.org_id) if org is None: return None org_settings = OrganizationSetting.objects.get(organization=org) db_name = org_settings.document_store # Explicitly create the new database. Should fail it db already exists. server = couchdb.client.Server(datawinners.settings.COUCH_DB_SERVER) server.create(db_name) manager = get_db_manager(server=datawinners.settings.COUCH_DB_SERVER, database=db_name) assert manager, "Could not create database manager for %s " % (db_name, ) run(manager)
def find_organization(): dbs = all_db_names(db_server) for db in dbs: print db manager = get_db_manager(server=db_server, database=db,credentials=settings.COUCHDBMAIN_CREDENTIALS) database_query = manager.database.query(map_project_id_to_organization) if database_query: organization_setting = OrganizationSetting.objects.filter(document_store=db)[0] organization_name = organization_setting.organization.name print ("********************************************") print "Document store: %s" % db print "Organization name: %s" % organization_name break remove_db_manager(manager)
def create_org_database(sender, user, request, **kwargs): from datawinners.initializer import run profile = user.get_profile() org = Organization.objects.get(org_id=profile.org_id) active_organization(org) org_settings = OrganizationSetting.objects.get(organization=org) db_name = org_settings.document_store # Explicitly create the new database. Should fail it db already exists. manager = get_db_manager(server=settings.COUCH_DB_SERVER, database=db_name) assert manager, "Could not create database manager for %s " % (db_name, ) run(manager) profile.reporter_id = make_user_as_a_datasender(manager, org, user.get_full_name(), profile.mobile_phone) profile.save()
def setUp(self): self.manager = get_db_manager('http://localhost:5984/', 'mangrove-test') define_type(self.manager, ["reporter"]) self.phone_number_type = DataDictType(self.manager, name='Telephone Number', slug='telephone_number', primitive_type='string') self.first_name_type = DataDictType(self.manager, name='First Name', slug='first_name', primitive_type='string') #Register Reporter self.register(self.manager, entity_type=["reporter"], data=[(MOBILE_NUMBER_FIELD, "1234567890", self.phone_number_type), (NAME_FIELD, "A", self.first_name_type)], location=[], source="sms", short_code="REP1") self.register(self.manager, entity_type=["reporter"], data=[(MOBILE_NUMBER_FIELD, "8888567890", self.phone_number_type), (NAME_FIELD, "B", self.first_name_type)], location=[], source="sms", short_code="rep5") self.register(self.manager, entity_type=["reporter"], data=[(MOBILE_NUMBER_FIELD, "1234567890", self.phone_number_type), (NAME_FIELD, "B", self.first_name_type)], location=[], source="sms", short_code="REP2")
def _set_db_manager(self): self.manager = get_db_manager('http://localhost:5984/', 'mangrove-test')
def setUp(self): self.manager = get_db_manager(database='mangrove-test') self._create_datadict_types() self._create_entities_and_data_records()
def setUp(self): self.dbm = get_db_manager(database='mangrove-test') self.create_data_dictionary_entries() self.create_entities() self.create_data_records() self.create_indicators()
def get_database_manager_for_user(user): profile = user.get_profile() organization = Organization.objects.get(org_id=profile.org_id) organization_settings = OrganizationSetting.objects.get(organization=organization) db = organization_settings.document_store return get_db_manager(server=settings.COUCH_DB_SERVER, database=db)
def setUp(self): self.dbm = get_db_manager(database='tree_test')
def setUp(self): self.dbm = get_db_manager(database='mangrove-test')
def setUp(self): self.dbm = get_db_manager(database='mangrove-test') self._create_form_model()
def entity(self): return get_db_manager(self.server, self.database).get(self.entity_id, Entity)
def setUp(self): self.dbm = get_db_manager(database='mangrove-test') e = Entity(self.dbm, entity_type="clinic", location=["India", "MH", "Pune"]) self.uuid = e.save()
def InitDb(self, server, database): self.manager = get_db_manager(server=server, database=database) _delete_db_and_remove_db_manager(self.manager) self.manager = get_db_manager(server=server, database=database) initializer.run(self.manager)
def setUp(self): self.database_manager = get_db_manager('http://localhost:5984/', 'mangrove-test')