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