

def test_default_authorisation(self):
    SilkyConfig().SILKY_AUTHENTICATION = True
    SilkyConfig().SILKY_AUTHORISATION = True
    SilkyConfig().SILKY_PERMISSIONS = default_permissions
    username_and_password = 'bob'
    user = User.objects.create(username=username_and_password)
    user.set_password(username_and_password)
    user.save()
    self.client.login(username=username_and_password, password=username_and_password)
    response = self.client.get(silky_reverse('requests'))
    self.assertEqual(response.status_code, 403)
    user.is_staff = True
    user.save()
    response = self.client.get(silky_reverse('requests'))
    self.assertEqual(response.status_code, 200)

dataset/ETHPy150Open django-silk/silk/project/tests/test_config_auth.py TestAuth.test_default_authorisation/original