def testClone(self): original = Location.getDefaultLocation() cloned = utils.clone(Location, original) assert cloned.id != original.id assert cloned.name == original.name assert cloned.default_aspect.id == original.default_aspect.id
def testSetDefaultLocation(self): if len(LOCATIONS) < 2: raise RuntimeWarning('Not enough locations for tis test,' ' there should be at least 2 locations') else: old_default = Location.getDefaultLocation() name = None for l, loc in self.iterLocations(): if not loc.is_default: Location.setDefaultLocation(loc) db.session.commit() name = l['name'] self.assertTrue(loc.is_default) break assert name == Location.getDefaultLocation().name # revert change to decrease dependency between tests Location.setDefaultLocation(old_default) db.session.commit()
def testGetDefaultLocation(self): for l, loc in self.iterLocations(): if 'is_default' in l: assert loc == Location.getDefaultLocation()