Esempio n. 1
0
 def setUp(self):
     # we have to set the fake database before any other calls
     self.orig_db = CommCareCase.get_db()
     self.database = FakeCouchDb()
     CommCareCase.set_db(self.database)
     self.spec = {
         "type": "related_doc",
         "related_doc_type": "CommCareCase",
         "doc_id_expression": {"type": "property_name", "property_name": "parent_id"},
         "value_expression": {"type": "property_name", "property_name": "related_property"},
     }
     self.expression = ExpressionFactory.from_spec(self.spec)
     self.nested_expression = ExpressionFactory.from_spec(
         {
             "type": "related_doc",
             "related_doc_type": "CommCareCase",
             "doc_id_expression": {"type": "property_name", "property_name": "parent_id"},
             "value_expression": {
                 "type": "related_doc",
                 "related_doc_type": "CommCareCase",
                 "doc_id_expression": {"type": "property_name", "property_name": "parent_id"},
                 "value_expression": {"type": "property_name", "property_name": "related_property"},
             },
         }
     )
Esempio n. 2
0
 def setUp(self):
     self.database = FakeCouchDb()
     self.case_orig_db = CommCareCase.get_db()
     self.form_orig_db = XFormInstance.get_db()
     self.user_orig_db = CommCareUser.get_db()
     CommCareCase.set_db(self.database)
     XFormInstance.set_db(self.database)
     CommCareUser.set_db(self.database)
Esempio n. 3
0
 def setUp(self):
     self.database = FakeCouchDb()
     self.case_orig_db = CommCareCase.get_db()
     self.form_orig_db = XFormInstance.get_db()
     self.user_orig_db = CommCareUser.get_db()
     CommCareCase.set_db(self.database)
     XFormInstance.set_db(self.database)
     CommCareUser.set_db(self.database)
Esempio n. 4
0
 def setUp(self):
     self.database = FakeCouchDb()
     self.case_orig_db = CommCareCase.get_db()
     self.form_orig_db = XFormInstance.get_db()
     self.user_orig_db = CommCareUser.get_db()
     CommCareCase.set_db(self.database)
     XFormInstance.set_db(self.database)
     CommCareUser.set_db(self.database)
     self.factory = RequestFactory()
     domain = Domain.get_or_create_with_name('up-nrhm')
     domain.is_active = True
     domain.save()
     self.domain = domain
     user = WebUser.get_by_username('test')
     if not user:
         user = WebUser.create(domain.name, 'test', 'passwordtest')
     user.is_authenticated = True
     user.is_superuser = True
     user.is_authenticated = True
     user.is_active = True
     self.user = user
Esempio n. 5
0
 def setUp(self):
     self.database = FakeCouchDb()
     self.case_orig_db = CommCareCase.get_db()
     self.form_orig_db = XFormInstance.get_db()
     self.user_orig_db = CommCareUser.get_db()
     CommCareCase.set_db(self.database)
     XFormInstance.set_db(self.database)
     CommCareUser.set_db(self.database)
     self.factory = RequestFactory()
     domain = Domain.get_or_create_with_name('up-nrhm')
     domain.is_active = True
     domain.save()
     self.domain = domain
     user = WebUser.get_by_username('test')
     if not user:
         user = WebUser.create(domain.name, 'test', 'passwordtest')
     user.is_authenticated = True
     user.is_superuser = True
     user.is_authenticated = True
     user.is_active = True
     self.user = user
 def setUp(self):
     # we have to set the fake database before any other calls
     self.orig_db = CommCareCase.get_db()
     self.database = FakeCouchDb()
     CommCareCase.set_db(self.database)
     self.spec = {
         "type": "related_doc",
         "related_doc_type": "CommCareCase",
         "doc_id_expression": {
             "type": "property_name",
             "property_name": "parent_id"
         },
         "value_expression": {
             "type": "property_name",
             "property_name": "related_property"
         }
     }
     self.expression = ExpressionFactory.from_spec(self.spec)
     self.nested_expression = ExpressionFactory.from_spec({
         "type":
         "related_doc",
         "related_doc_type":
         "CommCareCase",
         "doc_id_expression": {
             "type": "property_name",
             "property_name": "parent_id"
         },
         "value_expression": {
             "type": "related_doc",
             "related_doc_type": "CommCareCase",
             "doc_id_expression": {
                 "type": "property_name",
                 "property_name": "parent_id"
             },
             "value_expression": {
                 "type": "property_name",
                 "property_name": "related_property"
             }
         }
     })
Esempio n. 7
0
 def tearDown(self):
     CommCareCase.set_db(self.orig_db)
Esempio n. 8
0
 def setUp(self):
     self.orig_db = CommCareCase.get_db()
     self.database = FakeCouchDb()
     CommCareCase.set_db(self.database)
Esempio n. 9
0
 def tearDown(self):
     CommCareCase.set_db(self.case_orig_db)
     XFormInstance.set_db(self.form_orig_db)
     CommCareUser.set_db(self.user_orig_db)
Esempio n. 10
0
 def tearDown(self):
     CommCareCase.set_db(self.orig_db)
Esempio n. 11
0
 def tearDown(self):
     CommCareCase.set_db(self.case_orig_db)
     XFormInstance.set_db(self.form_orig_db)
     CommCareUser.set_db(self.user_orig_db)