def test_insert_model(self): model = ModelWithUser.find_by_name('With User') self.assertIsNone(model) process_message(get_object_json()) model = ModelWithUser.find_by_name('With User') self.assertIsNotNone(model) self.assertIsNone(model.user)
def test_insert_model(self): model = ModelWithUser.find_by_name('With User') self.assertIsNone(model) process_message(get_object_json()) model = ModelWithUser.find_by_name('With User') self.assertIsNotNone(model) self.assertIsNone(model.user)
def test_delete_model(self): model = ModelWithUser(name='With User', uuid='c03a1839-6eb3-4565-b256-e0aea5ec8437') model.save() model = ModelWithUser.find_by_name('With User') self.assertIsNotNone(model) process_message(get_object_json(to_delete=True)) model = ModelWithUser.find_by_name('With User') self.assertIsNone(model)
def test_delete_model(self): model = ModelWithUser(name='With User', uuid='c03a1839-6eb3-4565-b256-e0aea5ec8437') model.save() model = ModelWithUser.find_by_name('With User') self.assertIsNotNone(model) process_message(get_object_json(to_delete=True)) model = ModelWithUser.find_by_name('With User') self.assertIsNone(model)
def test_update_without_user(self): model_without_user = get_object(model_name='modelwithoutuser', name='Without User Before Update', uuid='daf86b06-b784-4e02-9131-3098da60506c') model_without_user.save() model_id = model_without_user.id model_without_user = ModelWithoutUser.find_by_id(id=model_id) self.assertEqual(model_without_user.name, 'Without User Before Update') process_message(get_object_json(model_name='modelwithoutuser')) model_without_user = ModelWithoutUser.find_by_id(id=model_id) self.assertEqual(model_without_user.name, 'Without User')
def test_update_without_user(self): model_without_user = get_object(model_name='modelwithoutuser', name='Without User Before Update', uuid='daf86b06-b784-4e02-9131-3098da60506c') model_without_user.save() model_id = model_without_user.id model_without_user = ModelWithoutUser.find_by_id(id=model_id) self.assertEqual(model_without_user.name, 'Without User Before Update') process_message(get_object_json(model_name='modelwithoutuser')) model_without_user = ModelWithoutUser.find_by_id(id=model_id) self.assertEqual(model_without_user.name, 'Without User')
def test_update_with_user_object_user_undefined(self): model_with_user = get_object(model_name='modelwithuser', name='With User Undefined', uuid='c03a1839-6eb3-4565-b256-e0aea5ec8437') model_with_user.save() model_id = model_with_user.id model_with_user = ModelWithUser.find_by_id(id=model_id) self.assertEqual(model_with_user.name, 'With User Undefined') self.assertIsNone(model_with_user.user) process_message(get_object_json(model_name='modelwithuser')) model_with_user = ModelWithUser.find_by_id(id=model_id) self.assertEqual(model_with_user.name, 'With User') self.assertIsNone(model_with_user.user)
def test_update_with_user_object_user_undefined(self): model_with_user = get_object(model_name='modelwithuser', name='With User Undefined', uuid='c03a1839-6eb3-4565-b256-e0aea5ec8437') model_with_user.save() model_id = model_with_user.id model_with_user = ModelWithUser.find_by_id(id=model_id) self.assertEqual(model_with_user.name, 'With User Undefined') self.assertIsNone(model_with_user.user) process_message(get_object_json(model_name='modelwithuser')) model_with_user = ModelWithUser.find_by_id(id=model_id) self.assertEqual(model_with_user.name, 'With User') self.assertIsNone(model_with_user.user)