Example #1
0
def test_parse_url(testcase, func_kwargs, exp_scheme, exp_hostport, exp_url):
    """
    Test function for cim_http.parse_url()
    """

    # The code to be tested
    act_scheme, act_hostport, act_url = cim_http.parse_url(**func_kwargs)

    # Ensure that exceptions raised in the remainder of this function
    # are not mistaken as expected exceptions
    assert testcase.exp_exc_types is None

    # Verify the result
    assert act_scheme == exp_scheme
    assert act_hostport == exp_hostport
    assert act_url == exp_url
Example #2
0
    def _run_single_defaults_false(self, url, exp_host, exp_port, exp_ssl):
        '''
        Test function for single invocation of parse_url() with the default
        attribute set false
        '''

        host, port, ssl = cim_http.parse_url(url, allow_defaults=False)

        self.assertEqual(
            host, exp_host,
            "Unexpected host: %r, expected: %r" % (host, exp_host))
        self.assertEqual(
            port, exp_port,
            "Unexpected port: %r, expected: %r" % (port, exp_port))
        self.assertEqual(ssl, exp_ssl,
                         "Unexpected ssl: %r, expected: %r" % (ssl, exp_ssl))
Example #3
0
    def _run_single(self, url, exp_host, exp_port, exp_ssl):
        '''
        Test function for single invocation of parse_url() and
        allow_defaults attribute =True(default)
        '''

        host, port, ssl = cim_http.parse_url(url)

        self.assertEqual(
            host, exp_host,
            "Unexpected host: %r, expected: %r" % (host, exp_host))
        self.assertEqual(
            port, exp_port,
            "Unexpected port: %r, expected: %r" % (port, exp_port))
        self.assertEqual(ssl, exp_ssl,
                         "Unexpected ssl: %r, expected: %r" % (ssl, exp_ssl))
Example #4
0
    def _run_single(self, url, exp_host, exp_port, exp_ssl):
        '''
        Test function for single invocation of parse_url()
        '''

        host, port, ssl = cim_http.parse_url(url)

        self.assertEqual(host, exp_host,
                         "Unexpected host: %r, expected: %r" %\
                         (host, exp_host))
        self.assertEqual(port, exp_port,
                         "Unexpected port: %r, expected: %r" %\
                         (port, exp_port))
        self.assertEqual(ssl, exp_ssl,
                         "Unexpected ssl: %r, expected: %r" %\
                         (ssl, exp_ssl))
Example #5
0
    def _run_single_defaults_false(self, url, exp_host, exp_port, exp_ssl):
        '''
        Test function for single invocation of parse_url() with the default
        attribute set false
        '''

        host, port, ssl = cim_http.parse_url(url, allow_defaults=False)

        self.assertEqual(host, exp_host,
                         "Unexpected host: %r, expected: %r" %
                         (host, exp_host))
        self.assertEqual(port, exp_port,
                         "Unexpected port: %r, expected: %r" %
                         (port, exp_port))
        self.assertEqual(ssl, exp_ssl,
                         "Unexpected ssl: %r, expected: %r" %
                         (ssl, exp_ssl))
Example #6
0
    def _run_single(self, url, exp_host, exp_port, exp_ssl):
        '''
        Test function for single invocation of parse_url() and
        allow_defaults attribute =True(default)
        '''

        host, port, ssl = cim_http.parse_url(url)

        self.assertEqual(host, exp_host,
                         "Unexpected host: %r, expected: %r" %
                         (host, exp_host))
        self.assertEqual(port, exp_port,
                         "Unexpected port: %r, expected: %r" %
                         (port, exp_port))
        self.assertEqual(ssl, exp_ssl,
                         "Unexpected ssl: %r, expected: %r" %
                         (ssl, exp_ssl))