コード例 #1
0
 def test_create_config_file_wrong_user(self):
     with mock.patch('pwd.getpwnam', side_effect=KeyError):
         config = metadata_driver.HaproxyConfigurator(
             mock.ANY, mock.ANY, mock.ANY, mock.ANY, self.EUNAME,
             self.EGNAME, mock.ANY, mock.ANY)
         self.assertRaises(metadata_driver.InvalidUserOrGroupException,
                           config.create_config_file)
コード例 #2
0
 def test_create_config_file_wrong_group(self):
     with mock.patch('grp.getgrnam', side_effect=KeyError),\
             mock.patch('pwd.getpwnam',
                        return_value=test_utils.FakeUser(self.EUNAME)):
         config = metadata_driver.HaproxyConfigurator(
             mock.ANY, mock.ANY, mock.ANY, mock.ANY, self.EUNAME,
             self.EGNAME, mock.ANY, mock.ANY)
         self.assertRaises(metadata_driver.InvalidUserOrGroupException,
                           config.create_config_file)