Example #1
0
    def test_profile_update_can_redirect_after_POST_request(self):
        request = HttpRequest()
        request.method = "POST"
        request.POST["name"] = "New Testing Corp"
        request.POST["service"] = "New Testing Services"

        response = profile_update(request)

        self.assertEqual(response.status_code, 302)
        self.assertEqual(response["location"], "/slapp/profile_update/")
Example #2
0
    def test_profile_update_can_save_a_POST_request(self):
        request = HttpRequest()
        request.method = "POST"
        request.POST["name"] = "New Testing Corp"
        request.POST["service"] = "New Testing Services"

        response = profile_update(request)

        self.assertEqual(Company.objects.count(), 1)
        new_company = Company.objects.first()
        self.assertEqual(new_company.name, "New Testing Corp")
        self.assertEqual(new_company.service, "New Testing Services")