Exemplo n.º 1
0
 def test_should_get_the_assigned_value(self):
     objectsMock = DjangoModelObjectsMock()
     objectsMock.start()
     objectsMock.when_called_with(name = 'value').return_value = 'assigned_value'
     result = MyModel.objects.get(name = 'value')
     self.assertEqual('assigned_value', result)
     objectsMock.stop()
Exemplo n.º 2
0
 def test_should_get_a_mock_when_the_modelObject_mock_is_applied(self):
     objectsMock = DjangoModelObjectsMock()
     objectsMock.start()
     result = MyModel.objects.get()
     self.assertIsInstance(result, Mock)
     objectsMock.stop()