~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/errors.py

ivle.webapp.testing: Add, with fake request and user.
ivle.webapp.base.test: Add! Test the JSONRESTView, using the new mocks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    '''A base class for all HTTP errors.'''
22
22
 
23
23
class BadRequest(HTTPError):
24
 
    codename = 'Bad Request'
25
24
    code = 400
26
25
 
27
 
class Unauthorized(HTTPError):
28
 
    codename = 'Unauthorized'
29
 
    code = 401
30
 
 
31
26
class Forbidden(HTTPError):
32
 
    codename = 'Forbidden'
33
27
    code = 403
34
28
 
35
29
class NotFound(HTTPError):
36
 
    codename = 'Not Found'
37
30
    code = 404
38
 
 
39
 
class MethodNotAllowed(HTTPError):
40
 
    def __init__(self, allowed, *args, **kwargs):
41
 
        self.allowed = allowed
42
 
        super(HTTPError, self).__init__(*args, **kwargs)
43
 
 
44
 
    codename = 'Method Not Allowed'
45
 
    code = 405