def bye():
     abort(404)
 async def get(self, request):
     abort(self.err)
Exemplo n.º 3
0
 def test_abort_no_data(self):
     with pytest.raises(HTTPException) as cm:
         restplus.abort(404)
     assert not hasattr(cm.value, 'data')
Exemplo n.º 4
0
 def test_abort_custom_message(self):
     with pytest.raises(HTTPException) as cm:
         restplus.abort(404, 'My message')
     assert cm.value.data['message'] == 'My message'
Exemplo n.º 5
0
 def test_abort_type(self):
     with pytest.raises(HTTPException):
         restplus.abort(404)
Exemplo n.º 6
0
 def test_abort_data(self):
     with pytest.raises(HTTPException) as cm:
         restplus.abort(404, foo='bar')
     assert cm.value.data == {'foo': 'bar'}
Exemplo n.º 7
0
 async def get(self, request):
     abort(404)
Exemplo n.º 8
0
 def test_abort_custom_message(self):
     with pytest.raises(SanicException) as cm:
         abort(404, 'My message')
     assert cm.value.args[0] == 'My message'
Exemplo n.º 9
0
 def test_abort_type(self):
     with pytest.raises(SanicException):
         abort(404)
Exemplo n.º 10
0
 def test_abort_no_data(self):
     with pytest.raises(SanicException) as cm:
         abort(404)
     assert not hasattr(cm.value, 'data')
Exemplo n.º 11
0
 def test_abort_data(self):
     with pytest.raises(SanicException) as cm:
         abort(404, foo='bar')
     assert cm.value.data == {'foo': 'bar'}