Пример #1
0
    def test_create_multiple_heartbeats(self):
        """Test that no race condition occurs when creating heartbeats."""
        uuid, user, _ = self._register_device()

        def upload_report(client, data):
            response = client.post(reverse(self.LIST_CREATE_URL), data)
            self.assertEqual(status.HTTP_201_CREATED, response.status_code)
            connection.close()

        data = Dummy.heartbeat_data(uuid=uuid)
        argslist = [[user,
                     dict(data, date=data["date"] + timedelta(days=i))]
                    for i in range(10)]

        self._test_create_multiple(HeartBeat, upload_report, argslist,
                                   "device_local_id")
Пример #2
0
 def _create_dummy_data(**kwargs):
     return Dummy.heartbeat_data(**kwargs)