def testFunctionDecoratorNotFound(self): """ Check if it fails with Exception in case request is not stored """ self.requests.post = RequestResponseHandling.decorator_all_keys()( self.requests.post) self.cassette.dump() self.cassette.mode = StorageMode.read self.assertRaises(Exception, self.requests.post, self.domain, data={"a": "b"})
def testFunctionDecoratorNotFound(self): """ Check if it fails with Exception in case request is not stored """ self.requests.post = RequestResponseHandling.decorator_all_keys( self.requests.post) PersistentObjectStorage().dump() PersistentObjectStorage()._is_write_mode = False self.assertRaises(Exception, self.requests.post, self.domain, data={"a": "b"})
def testFunctionDecorator(self): """ Test main purpose of the class, decorate post function and use it then """ self.requests.post = RequestResponseHandling.decorator_all_keys()( self.requests.post) response_before = self.requests.post(self.domain) self.cassette.dump() self.cassette.mode = StorageMode.read response_after = self.requests.post(self.domain) self.assertEqual(response_before.text, response_after.text) self.assertRaises(Exception, self.requests.post, self.domain)
def testFunctionDecorator(self): """ Test main purpose of the class, decorate post function and use it then """ self.requests.post = RequestResponseHandling.decorator_all_keys( self.requests.post) response_before = self.requests.post(self.domain) PersistentObjectStorage().dump() PersistentObjectStorage()._is_write_mode = False response_after = self.requests.post(self.domain) self.assertEqual(response_before.text, response_after.text) self.assertRaises(Exception, self.requests.post, self.domain)