示例#1
0
    def test_response_timeout(self):
        """
        Test response with a timeout
        """
        # New result
        r = AsyncResponse()

        # Get the value, with 1 second timeout. this should always fail
        r.response(1)
示例#2
0
    def test_response_timeout(self):
        """
        Test response with a timeout
        """
        # New result
        r = AsyncResponse()

        # Get the value, with 1 second timeout. this should always fail
        r.response(1)
示例#3
0
    def test_create_and_resolve(self):
        """
        The most basic test for getting and setting results
        """
        # Create a new result
        r = AsyncResponse()

        # Should not be ready
        self.assertFalse(r.completed)

        # set the result
        r.resolve(TEST_RESPONSE)

        # Is the result ready
        self.assertTrue(r.completed)

        # test getting the result
        self.assertEqual(r.response(), TEST_RESPONSE)
示例#4
0
    def test_create_and_resolve(self):
        """
        The most basic test for getting and setting results
        """
        # Create a new result
        r = AsyncResponse()

        # Should not be ready
        self.assertFalse(r.completed)

        # set the result
        r.resolve(TEST_RESPONSE)

        # Is the result ready
        self.assertTrue(r.completed)

        # test getting the result
        self.assertEqual(r.response(), TEST_RESPONSE)