Esempio n. 1
0
    def test_12_unknown_exception_update(self):
        '''
        Tests the UPDATE request with an unknown error
        '''
        bad_rest_client = RestClient(RestClient(), 2, 3)
        success, response = \
            bad_rest_client.update_request(self.test_sample_from_portion, self.test_sample_select_portion,\
                                                self.test_sample_update_portion)

        # Test that the request contents came back as expected
        assert success == False
        assert response == "An unidentified error has occured: unsupported operand type(s) for +: 'RestClient' and 'int'."
Esempio n. 2
0
    def test_11_connection_error_update(self):
        '''
        Tests the UPDATE request with a connection error.
        '''
        # Try making the request, but with a bad url
        bad_rest_client = RestClient("http://", "255.255.255.255", "22")
        success, response = \
            bad_rest_client.update_request(self.test_sample_from_portion, self.test_sample_select_portion,\
                                                self.test_sample_update_portion)

        # Test that the request contents came back as expected
        assert success == False
        assert response == "A connection error has occured."