Beispiel #1
0
 def test_fuzz_port_false(self):
     host = 'www.example.com'
     port = '1234'
     uut = kurl.HostPort(host, int(port), fuzz_host=True, fuzz_port=False, fuzz_delim=True)
     mutations = get_mutation_set(uut)
     if not all(port in mutation for mutation in mutations):
         raise Exception('port does not always appear')
Beispiel #2
0
 def test_fuzz_host_true(self):
     host = 'www.example.com'
     port = 1234
     uut = kurl.HostPort(host, port, fuzz_host=True, fuzz_port=False, fuzz_delim=False)
     mutations = get_mutation_set(uut)
     if all(host in mutation for mutation in mutations):
         raise Exception('host always appear')
Beispiel #3
0
 def test_constructed_url_no_path(self):
     '''
     verify the default value of a url without serach (query) field
     '''
     expected = 'http://www.google.com:123'
     container = kurl.HttpUrl(
         'http',
         hostport=kurl.HostPort('www.google.com', port=123, name='our host'),
         name='uut'
     )
     actual = container.render().bytes
     self.assertEqual(actual, expected)
Beispiel #4
0
 def test_constructed_url_no_login(self):
     '''
     verify the default value of a url without login
     '''
     expected = 'http://www.google.com:123/index.html?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8'
     container = kurl.HttpUrl(
         'http',
         hostport=kurl.HostPort('www.google.com', port=123, name='our host'),
         path=kurl.Path('index.html', name='the page'),
         search=kurl.Search('sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8'),
         name='uut'
     )
     actual = container.render().bytes
     self.assertEqual(actual, expected)
Beispiel #5
0
 def test_no_port(self):
     expected = 'www.example.com'
     uut = kurl.HostPort('www.example.com')
     actual = uut.render().bytes
     self.assertEqual(actual, expected)
Beispiel #6
0
 def test_default_full(self):
     expected = 'www.example.com:1234'
     uut = kurl.HostPort('www.example.com', port=1234)
     actual = uut.render().bytes
     self.assertEqual(actual, expected)