def setUp(self): # we have to set the fake database before any other calls self.domain = "test-loc-parent-id" self.evaluation_context = EvaluationContext({"domain": self.domain}) self.orig_db = Location.get_db() self.database = FakeCouchDb() Location.set_db(self.database) self.parent = self._make_location(_id=uuid.uuid4().hex) self.child = self._make_location(_id=uuid.uuid4().hex, lineage=[self.parent._id]) self.grandchild = self._make_location(_id=uuid.uuid4().hex, lineage=[self.child._id, self.parent._id]) self.expression_spec = { "type": "location_parent_id", "location_id_expression": {"type": "property_name", "property_name": "location_id"}, } self.expression = ExpressionFactory.from_spec(self.expression_spec)
def setUp(self): # we have to set the fake database before any other calls self.domain = 'test-loc-parent-id' self.evaluation_context = EvaluationContext({"domain": self.domain}) self.orig_db = Location.get_db() self.database = FakeCouchDb() Location.set_db(self.database) self.parent = self._make_location(_id=uuid.uuid4().hex) self.child = self._make_location(_id=uuid.uuid4().hex, lineage=[self.parent._id]) self.grandchild = self._make_location( _id=uuid.uuid4().hex, lineage=[self.child._id, self.parent._id]) self.expression_spec = { "type": "location_parent_id", "location_id_expression": { "type": "property_name", "property_name": "location_id", } } self.expression = ExpressionFactory.from_spec(self.expression_spec)
def tearDown(self): Location.set_db(self.orig_db)