Exemplo n.º 1
0
 def create_model(self):
     reader = Reader()
     reader.uuid = "uuid_of_device"
     reader.device_token = "token_of_device"
     reader.os = ANDROID
     return reader
Exemplo n.º 2
0
 def tearDown(self):
     Reader.drop_collection()
     self.model = None
Exemplo n.º 3
0
 def test_save_not_call(self,getByUUIDMock, saveMock):
     model = self.model
     getByUUIDMock.return_value = model, False
     Reader.getOrCreate(uuid=model.uuid, os=model.os, token=model.device_token)
     saveMock.assert_called_once_with()
Exemplo n.º 4
0
 def test_save_to_database(self):
     model = self.model
     Reader.getOrCreate(uuid=model.uuid, os=model.os, token=model.device_token)
     self.assertIsNotNone(Reader.objects.first())
Exemplo n.º 5
0
 def test_get_by_uuid(self, getByUUIDMock):
     model = self.model
     getByUUIDMock.return_value = model, False
     reader = Reader.getOrCreate(uuid=model.uuid, os=model.os, token=model.device_token)
     getByUUIDMock.assert_called_once_with(uuid=model.uuid)
     self.assertEqual(model,reader)