def test_http_unavailable_for_legal_reasons_no_title_and_desc_and_challenges(self): try: raise falcon.HTTPUnavailableForLegalReasons() except falcon.HTTPUnavailableForLegalReasons as e: self.assertEqual(status.HTTP_451, e.title, 'The title should be ' + status.HTTP_451 + ', but it is: ' + e.title) self.assertEqual(None, e.description, 'The description should be None')
def test_http_unavailable_for_legal_reasons_with_title_and_desc_and_challenges(self): try: raise falcon.HTTPUnavailableForLegalReasons(title='Test', description='Testdescription') except falcon.HTTPUnavailableForLegalReasons as e: self.assertEqual('Test', e.title, 'Title should be "Test"') self.assertEqual('Testdescription', e.description, 'Description should be "Testdescription"')
def on_delete_collection(self, req, resp, fish): if fish != 'wet': raise falcon.HTTPUnavailableForLegalReasons('fish must be wet') self._items = {} resp.status = falcon.HTTP_NO_CONTENT