Exemplo n.º 1
0
 def test_unit_of_work_roundtrip(self):
     unit = UnitOfWork(None)
     loc = Location(10, 11)
     loc.name = "Loc 1"
     unit.insert(loc)
     unit_dict = self.marshaller.obj_to_dict(unit)
     self.assertEquals("unit_of_work", unit_dict["class"])
     
     unit2 = self.marshaller.dict_to_obj(unit_dict)
     self.assertEquals(10.0, unit2._to_insert[0].latitude)
     self.assertEquals(11.0, unit2._to_insert[0].longitude)
Exemplo n.º 2
0
    def test_unit_of_work_roundtrip(self):
        unit = UnitOfWork(None)
        loc = Location(10, 11)
        loc.name = "Loc 1"
        unit.insert(loc)
        unit_dict = self.marshaller.obj_to_dict(unit)
        self.assertEquals("unit_of_work", unit_dict["class"])

        unit2 = self.marshaller.dict_to_obj(unit_dict)
        self.assertEquals(10.0, unit2._to_insert[0].latitude)
        self.assertEquals(11.0, unit2._to_insert[0].longitude)
Exemplo n.º 3
0
 def test_unit_of_work_validation(self):
     unit = UnitOfWork(None)
     loc = Location(10, 11)
     self.assertRaises(InvalidObjectError, unit.insert, loc)
     loc.name = "test"
     unit.insert(loc) # Should work now.
Exemplo n.º 4
0
 def test_unit_of_work_validation(self):
     unit = UnitOfWork(None)
     loc = Location(10, 11)
     self.assertRaises(InvalidObjectError, unit.insert, loc)
     loc.name = "test"
     unit.insert(loc)  # Should work now.