def test_update_whisky(self): whisky = self.create_test_whisky() self.whisky_dict['wid'] = whisky.wid self.whisky_dict['name'] = 'updated' updated_whisk = Whisky.update_whisky(self.whisky_dict, self.user.uid) self.assertEqual(whisky.wid, updated_whisk.wid) self.assertEqual(whisky.name, updated_whisk.name) for key in self.whisky_dict: self.assertEqual(whisky.__getattribute__(key), updated_whisk.__getattribute__(key))
def test_update_whisky_only_owner(self): whisky = self.create_test_whisky() self.whisky_dict['wid'] = 1 failed_whisk = Whisky.update_whisky(self.whisky_dict, 2) self.assertIsNone(failed_whisk)