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)
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)
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)
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)