def test_from_ini_explicit_vendor(self):
     config = Config.from_ini(_EXPLICIT_VENDOR_INI)
     self.assertEqual(
         config.find_host(self._HOST_A_NAME).vendor,
         self._HOST_B_VENDOR)
 def test_from_ini_missing_host_hash(self):
     with six.assertRaisesRegex(self, ValueError, 'hash'):
         Config.from_ini(_MISSING_HOST_HASH_INI)
 def test_from_ini_host_vendor_undefined(self):
     with six.assertRaisesRegex(self, ValueError,
                                'Undefined vendor .+ for host'):
         Config.from_ini(_HOST_VENDOR_UNDEFINED_INI)
 def test_from_ini_missing_hosts(self):
     with six.assertRaisesRegex(self, ValueError, 'at least one'):
         Config.from_ini(_MISSING_HOSTS_INI)
 def test_from_ini_missing_host_key(self):
     with six.assertRaisesRegex(self, ValueError, 'key'):
         Config.from_ini(_MISSING_HOST_KEY_INI)
 def test_from_ini_default_vendor_undefined(self):
     with six.assertRaisesRegex(self, ValueError, 'At least one'):
         Config.from_ini(_DEFAULT_VENDOR_UNDEFINED_INI)
 def test_from_ini_default_vendor_unspecified(self):
     with six.assertRaisesRegex(self, ValueError, 'when more than one is'):
         Config.from_ini(_DEFAULT_VENDOR_UNSPECIFIED_INI)
 def test_from_ini_default_vendor_invalid(self):
     with six.assertRaisesRegex(self, ValueError,
                                'specified does not correspond'):
         Config.from_ini(_DEFAULT_VENDOR_INVALID_INI)
 def test_from_ini_empty_vendors(self):
     with six.assertRaisesRegex(self, ValueError, 'At least one'):
         Config.from_ini(_EMPTY_VENDORS_INI)
 def test_from_ini_missing_vendors(self):
     with six.assertRaisesRegex(self, ValueError, 'special:vendors section'):
         Config.from_ini(_MISSING_VENDORS_INI)
 def test_from_ini_malformed(self):
     # must be compatible with 2 and 3 - malformed ini treated differently
     with self.assertRaises(ValueError):
         Config.from_ini(_MALFORMED_INI)
 def test_from_ini_empty(self):
     with self.assertRaises(ValueError):
         Config.from_ini(_EMPTY_INI)