Esempio n. 1
0
 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"})
Esempio n. 2
0
 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"})
Esempio n. 3
0
    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)
Esempio n. 4
0
    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)