def bye():
     abort(404)
 async def get(self, request):
     abort(self.err)
Beispiel #3
0
 def test_abort_no_data(self):
     with pytest.raises(HTTPException) as cm:
         restplus.abort(404)
     assert not hasattr(cm.value, 'data')
Beispiel #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'
Beispiel #5
0
 def test_abort_type(self):
     with pytest.raises(HTTPException):
         restplus.abort(404)
Beispiel #6
0
 def test_abort_data(self):
     with pytest.raises(HTTPException) as cm:
         restplus.abort(404, foo='bar')
     assert cm.value.data == {'foo': 'bar'}
 async def get(self, request):
     abort(404)
 def test_abort_custom_message(self):
     with pytest.raises(SanicException) as cm:
         abort(404, 'My message')
     assert cm.value.args[0] == 'My message'
 def test_abort_type(self):
     with pytest.raises(SanicException):
         abort(404)
Beispiel #10
0
 def test_abort_no_data(self):
     with pytest.raises(SanicException) as cm:
         abort(404)
     assert not hasattr(cm.value, 'data')
Beispiel #11
0
 def test_abort_data(self):
     with pytest.raises(SanicException) as cm:
         abort(404, foo='bar')
     assert cm.value.data == {'foo': 'bar'}