Beispiel #1
0
    def test_create_multiple_crashreports(self):
        """Test that no race condition occurs when creating crashreports."""
        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.crashreport_data(uuid=uuid)
        argslist = [[
            user,
            dict(data, date=data["date"] + timedelta(milliseconds=i))
        ] for i in range(10)]

        self._test_create_multiple(Crashreport, upload_report, argslist,
                                   "device_local_id")
Beispiel #2
0
    def upload_crashreport(self, user, uuid):
        """
        Upload dummy crashreport data.

        Args:
            user: The user which should be used for uploading the report
            uuid: The uuid of the device to which the report should be uploaded

        Returns: The local id of the device for which the report was uploaded.

        """
        data = Dummy.crashreport_data(uuid=uuid)
        response = user.post(reverse(LIST_CREATE_URL), data)
        self.assertEqual(status.HTTP_201_CREATED, response.status_code)
        self.assertTrue("device_local_id" in response.data)
        device_local_id = response.data["device_local_id"]

        return device_local_id
Beispiel #3
0
 def _create_dummy_data(**kwargs):
     return Dummy.crashreport_data(**kwargs)