Exemplo n.º 1
0
    def test_invalid_new_vendor_does_not_save(self):
        request = self.factory.post('/vendors/add', {'name': 'test123'})
        request.user = self.user

        response = views.new_vendor(request)

        self.assertEqual(response.status_code, 200)
        self.assertEqual(
            models.Vendor.objects.filter(name="test123").count(), 0)
Exemplo n.º 2
0
    def test_invalid_new_vendor_does_not_save(self):
        request = self.factory.post('/vendors/add',
                                    { 'name': 'test123' })
        request.user = self.user

        response = views.new_vendor(request)

        self.assertEqual(response.status_code, 200)
        self.assertEqual(models.Vendor.objects.filter(name="test123").count(), 0)
Exemplo n.º 3
0
    def test_valid_new_vendor_redirects(self):
        request = self.factory.post('/vendors/add',
                                    { 'name': 'test123',
                                      'address': '123 Main st'})
        request.user = self.user

        response = views.new_vendor(request)

        self.assertEqual(response.status_code, 302)
        self.assertEqual(models.Vendor.objects.filter(name="test123").count(), 1)
Exemplo n.º 4
0
    def test_valid_new_vendor_redirects(self):
        request = self.factory.post('/vendors/add', {
            'name': 'test123',
            'address': '123 Main st'
        })
        request.user = self.user

        response = views.new_vendor(request)

        self.assertEqual(response.status_code, 302)
        self.assertEqual(
            models.Vendor.objects.filter(name="test123").count(), 1)