Check conf file permission
Since SafeConfigParser.read doesn't thrown an exception when a file can not be opened, we must explicitly check first. Change-Id: Ifa5c58e5c30323956a401beae9396ffb0b97dbd9 Closes-Bug: #1692587
This commit is contained in:
		@@ -686,6 +686,18 @@ class TestRefstackClient(unittest.TestCase):
 | 
			
		||||
        client = rc.RefstackClient(args)
 | 
			
		||||
        self.assertRaises(SystemExit, client.test)
 | 
			
		||||
 | 
			
		||||
    def test_forbidden_conf_file(self):
 | 
			
		||||
        """
 | 
			
		||||
        Test when the user passes in a file that the user does not have
 | 
			
		||||
        read access to.
 | 
			
		||||
        """
 | 
			
		||||
        file = tempfile.NamedTemporaryFile()
 | 
			
		||||
        # Remove read access
 | 
			
		||||
        os.chmod(file.name, 0o220)
 | 
			
		||||
        args = rc.parse_cli_args(self.mock_argv(conf_file_name=file.name))
 | 
			
		||||
        client = rc.RefstackClient(args)
 | 
			
		||||
        self.assertRaises(SystemExit, client.test)
 | 
			
		||||
 | 
			
		||||
    def test_run_tempest_nonexisting_directory(self):
 | 
			
		||||
        """
 | 
			
		||||
        Test when the Tempest directory does not exist.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user