Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 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)
Example #4
0
 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)
Example #5
0
 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')
Example #6
0
 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')
Example #7
0
 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)
Example #8
0
 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)