コード例 #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')
コード例 #2
0
 def test_build_address_defaults(self):
     c = conn.ConnInfo()
     self.assertEqual(c.buildAddress(url='/dataset'),
                      'http://localhost:19001/dataset')
コード例 #3
0
 def test_build_address_url_wrong_type(self):
     c = conn.ConnInfo()
     with self.assertRaises(TypeError):
         c.buildAddress(url=5)
コード例 #4
0
 def test_connType_set(self):
     c = conn.ConnInfo()
     c.connType = 'https'
     self.assertEqual(c.connType, 'https')
コード例 #5
0
 def test_connType_set_wrong_type(self):
     c = conn.ConnInfo()
     with self.assertRaises(TypeError):
         c.connType = 5
コード例 #6
0
 def test_host_set_wrong_type(self):
     c = conn.ConnInfo()
     with self.assertRaises(TypeError):
         c.host = 5
コード例 #7
0
 def test_host_set_empty_str(self):
     c = conn.ConnInfo()
     with self.assertRaises(ValueError):
         c.host = ''
コード例 #8
0
 def test_port_set_int_too_large(self):
     c = conn.ConnInfo()
     with self.assertRaises(ValueError):
         c.port = 9999999
コード例 #9
0
 def test_host_set(self):
     c = conn.ConnInfo()
     c.host = 'test'
     self.assertEqual(c.host, 'test')
コード例 #10
0
 def test_port_set_str_not_digit(self):
     c = conn.ConnInfo()
     with self.assertRaises(ValueError):
         c.port = 'asdf'
コード例 #11
0
 def test_port_set_int(self):
     c = conn.ConnInfo()
     c.port = 9001
     self.assertEqual(c.port, '9001')
コード例 #12
0
 def test_port_set_str(self):
     c = conn.ConnInfo()
     c.port = '9001'
     self.assertEqual(c.port, '9001')
コード例 #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')
コード例 #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')