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