'Create a fake request that emulates a request from the Segment servers to ours'

def create_request(self, key=None, **kwargs):

    if (key is None):
        key = SEGMENTIO_TEST_SECRET
    request = self.request_factory.post(((SEGMENTIO_TEST_ENDPOINT + '?key=') + key), **kwargs)
    if ('data' in kwargs):
        request.json = json.loads(kwargs['data'])
    return request
