def test_complete_redirects_if_checkout_is_not_paid(self):
     """If the checkout instance from the session is not marked as paid then
     the view will redirect to the payment page"""
     # checkout is not paid
     self.assertEqual(False, self.checkout.paid)
     # 
     request = self.rf.post(reverse('cccheckout:complete'))
     request.session['cccheckout'] = self.checkout
     r = complete(request)
     # redirects to payment
     self.assertEqual(reverse('cccheckout:payment'), r['Location'])
 def test_complete_if_paid(self):
     """If the checkout instance from the session is complete then the
     checkout page renders correctly"""
     # checkout is not paid
     self.checkout.paid = True
     # 
     request = self.rf.post(reverse('cccheckout:complete'))
     request.session['cccheckout'] = self.checkout
     r = complete(request)
     # status is 200
     self.assertEqual(200, r.status_code)
     # put checkout back to false
     self.checkout.paid = False
     self.checkout.save()