title: How to test a view using the request object
body: <p>I need to make tests to see if my view is working properly. However, I did not find how to use the request object in the test file.</p>
  
  <p>My view function is:</p>
  
  <pre><code>def track_view(request):
      user_email, user_order = request.session['email'], request.session['order']
      if request.method == 'POST':
          client_id = request.META.get('HTTP_HOST').split(':8000')[0]
          payload = "{ \n\"description\": \"Rastreio de pedido\", \n\"subject\": \"Rastreamento " + user_order + ' ' + user_email + "\", \n\"email\": \"" + user_email + "\", \n\"priority\": " + str(
              priority['low']) + ", \n\"status\": " + str(status['closed']) + ", \n\"group_id\": " + str(group[
                                                                                                            'Logística']) + ", \n\"type\": \"Rastrear Pedido\", \n\"product_id\": " + str(client[client_id]) + "}"
          headers = {
              'Content-Type': "application/json",
              'Cache-Control': "no-cache"
          }
  
          response = requests.request("POST", url, data=payload, headers=headers, auth=('XXX', 'X'))
  
          print(response.text)
          context = {'email_variable': user_email,
                     'order_variable': user_order}
          return redirect('atendimento:final_view')
      logo_image = 'client_logo/' + request.META.get('HTTP_HOST').split(':8000')[0] + '.png'
      context = {'logo_image': logo_image,
                 'user_email': request.POST.get('email'),
                 'user_order': request.session['order']}
      return render(request, 'atendimento/track_page.html', context)
  </code></pre>
  
  <p>How can I make that work to test different inputs to that view?</p>