def test_vernacular_name_nocreate_noupdate_noexisting(self): # do not create if not existing obj = VernacularName.retrieve_or_create( self.session, {"object": u"vernacular_name", "language": u"nap", "species": u"Brugmansia arborea"}, create=False, ) self.assertEquals(obj, None)
def test_vernacular_name_nocreate_updatediff_existing(self): ## update object in self.session obj = VernacularName.retrieve_or_create( self.session, {"object": "vernacular_name", "language": u"agr", "name": u"wronge", "species": u"Brugmansia arborea"}, create=False, update=True, ) self.assertEquals(obj.name, "wronge")
def test_vernacular_name_nocreate_noupdateeq_existing(self): ## retrieve same object, we only give the keys obj = VernacularName.retrieve_or_create( self.session, {"object": u"vernacular_name", "language": u"agr", "species": u"Brugmansia arborea"}, create=False, update=False, ) self.assertTrue(obj is not None) self.assertEquals(obj.name, "Toé")