Esempio n. 1
0
 def test_read_from_config_default(self):
     c = conn.ConnInfo()
     c.readFromConfig()
     self.assertEqual(c.host, 'dinkleburg')
     self.assertEqual(c.port, '748')
     self.assertEqual(c.connType, 'socks5')
Esempio n. 2
0
 def test_build_address_defaults(self):
     c = conn.ConnInfo()
     self.assertEqual(c.buildAddress(url='/dataset'),
                      'http://localhost:19001/dataset')
Esempio n. 3
0
 def test_build_address_url_wrong_type(self):
     c = conn.ConnInfo()
     with self.assertRaises(TypeError):
         c.buildAddress(url=5)
Esempio n. 4
0
 def test_connType_set(self):
     c = conn.ConnInfo()
     c.connType = 'https'
     self.assertEqual(c.connType, 'https')
Esempio n. 5
0
 def test_connType_set_wrong_type(self):
     c = conn.ConnInfo()
     with self.assertRaises(TypeError):
         c.connType = 5
Esempio n. 6
0
 def test_host_set_wrong_type(self):
     c = conn.ConnInfo()
     with self.assertRaises(TypeError):
         c.host = 5
Esempio n. 7
0
 def test_host_set_empty_str(self):
     c = conn.ConnInfo()
     with self.assertRaises(ValueError):
         c.host = ''
Esempio n. 8
0
 def test_port_set_int_too_large(self):
     c = conn.ConnInfo()
     with self.assertRaises(ValueError):
         c.port = 9999999
Esempio n. 9
0
 def test_host_set(self):
     c = conn.ConnInfo()
     c.host = 'test'
     self.assertEqual(c.host, 'test')
Esempio n. 10
0
 def test_port_set_str_not_digit(self):
     c = conn.ConnInfo()
     with self.assertRaises(ValueError):
         c.port = 'asdf'
Esempio n. 11
0
 def test_port_set_int(self):
     c = conn.ConnInfo()
     c.port = 9001
     self.assertEqual(c.port, '9001')
Esempio n. 12
0
 def test_port_set_str(self):
     c = conn.ConnInfo()
     c.port = '9001'
     self.assertEqual(c.port, '9001')
Esempio n. 13
0
 def test_constructor_full(self):
     c = conn.ConnInfo(host='diff', port='9001', connType='https')
     self.assertEqual(c.host, 'diff')
     self.assertEqual(c.port, '9001')
     self.assertEqual(c.connType, 'https')
Esempio n. 14
0
 def test_constructor_empty(self):
     c = conn.ConnInfo()
     self.assertEqual(c.host, 'localhost')
     self.assertEqual(c.port, '19001')
     self.assertEqual(c.connType, 'http')