Beispiel #1
0
    def test_show_locations_denied(self):
        request = self.factory.get('/acquisition_counter/')

        request.user = self.user

        response = views.locations(request)
        self.assertEqual(response.status_code, 302)
Beispiel #2
0
    def test_show_locations_denied(self):
        request = self.factory.get('/acquisition_counter/')

        request.user = self.user

        response = views.locations(request)
        self.assertEqual(response.status_code, 302)
Beispiel #3
0
    def test_show_locations(self):
        request = self.factory.get('/acquisition_counter/')

        self.user.is_superuser = True
        request.user = self.user

        response = views.locations(request)
        self.assertEqual(response.status_code, 200)
Beispiel #4
0
    def test_show_locations(self):
        request = self.factory.get('/acquisition_counter/')

        self.user.is_superuser = True
        request.user = self.user

        response = views.locations(request)
        self.assertEqual(response.status_code, 200)
Beispiel #5
0
    def test_create_location(self):
        idCustomer = Customer.objects.filter(name='Intern')[0].id
        request = self.factory.post('/locations/', {'name': 'testTest', 'street': '-', 'postcode': '12345', 'city': '-', 'country': 'DE', 'customer': idCustomer, 'status': 0})

        self.user.is_superuser = True
        request.user = self.user

        response = views.locations(request)
        locations = len(Location.objects.all())
        #print(response)
        self.assertEqual(locations, 2)
Beispiel #6
0
    def test_create_location(self):
        idCustomer = Customer.objects.filter(name='Intern')[0].id
        request = self.factory.post(
            '/locations/', {
                'name': 'testTest',
                'street': '-',
                'postcode': '12345',
                'city': '-',
                'country': 'DE',
                'customer': idCustomer,
                'status': 0
            })

        self.user.is_superuser = True
        request.user = self.user

        response = views.locations(request)
        locations = len(Location.objects.all())
        #print(response)
        self.assertEqual(locations, 2)