@override_settings(IOS_NOTIFICATIONS_AUTHENTICATION='AuthBasicIsStaff')
    def test_basic_authorization_is_staff_with_non_staff_user(self):
        kwargs = {'token': self.device.token, 'service__id': self.device.service.id}
        url = reverse('ios-notifications-device', kwargs=kwargs)
        user_pass = '%s:%s' % (self.user.username, self.user_password)
        auth_header = 'Basic %s' % user_pass.encode('base64')
        self.user.is_staff = False
        self.user.save()
        resp = self.client.get(url, HTTP_AUTHORIZATION=auth_header)
        self.assertEquals(resp.status_code, 401)
        self.assertTrue('authentication error' in resp.content)
dataset/ETHPy150Open stephenmuss/django-ios-notifications/ios_notifications/tests.py/AuthenticationDecoratorTestAuthBasic.test_basic_authorization_is_staff_with_non_staff_user/original