title: Django Testing view template context
body: <p>I'm trying to test the</p>
  
  <p><code>return render(request, 'template.html', context)</code></p>
  
  <p>and seem to be falling short. Is it not worth while testing this? Or if it is worth while testing this, how do I accomplish that?</p>
  
  <p>view.py</p>
  
  <pre><code>def create_employee_profile(request):
      name_form = EmployeeNameForm()
      context = {'name_form':name_form}
      return render(request,
                  'template_create_employee_profile.html',
                  context
                  )
  </code></pre>
  
  <p>I know the <code>if: else:</code> statements are missing. I didn't think they were relevant to the test.</p>
  
  <p>test.py</p>
  
  <pre><code># TEST:  context({'name_form':name_form})
  def test_CreateEmployeeProfileView_context(self):
      name_form = EmployeeNameForm()
      response = self.client.get(reverse(
                              'create_employee_profile'))
      self.assertEquals(response.context['name_form'], name_form)
  </code></pre>
  
  <p>This got me the closest to success. Here's my error:</p>
  
  <pre><code>AssertionError: &lt;Empl[27 chars]alid=False,
                  fields=(employee_choices;first_nam[20 chars]ame)&gt; != 
                  &lt;Empl[27 chars]alid=Unknown,
                  fields=(employee_choices;first_n[22 chars]ame)&gt;
  </code></pre>
  
  <p>What about the detail view?</p>
  
  <pre><code># TEST:  context({'name':name})
  def test_CustomerEmployeeProfileView_context(self):
      name = CustomerEmployeeName.objects.get(pk=1)
      response = self.client.get(
          reverse('service:customer_employee_profile_detail', kwargs={'pk': 1}))
  
      self.assertIsInstance(response.context['name'], name)
  </code></pre>
  
  <p>Got this error:</p>
  
  <pre><code>TypeError: isinstance() arg 2 must be a type or tuple of types
  </code></pre>