コード例 #1
0
ファイル: TestHostInfo.py プロジェクト: zhhzhfya/ambari-2.5
    def test_checkFolders(self, path_mock):
        path_mock.return_value = True
        hostInfo = HostInfo()
        results = []
        existingUsers = [{
            'name': 'a1',
            'homeDir': os.path.join('home', 'a1')
        }, {
            'name': 'b1',
            'homeDir': os.path.join('home', 'b1')
        }]
        hostInfo.checkFolders(
            [os.path.join("etc", "conf"),
             os.path.join("var", "lib"), "home"], ["a1", "b1"], ["c", "d"],
            existingUsers, results)
        print results
        self.assertEqual(6, len(results))
        names = [i['name'] for i in results]
        for item in [
                os.path.join('etc', 'conf', 'a1'),
                os.path.join('var', 'lib', 'a1'),
                os.path.join('etc', 'conf', 'b1'),
                os.path.join('var', 'lib', 'b1')
        ]:

            self.assertTrue(item in names)
コード例 #2
0
 def test_checkFolders(self, path_mock):
   path_mock.return_value = True
   hostInfo = HostInfo()
   results = []
   existingUsers = [{'name':'a1', 'homeDir':'/home/a1'}, {'name':'b1', 'homeDir':'/home/b1'}]
   hostInfo.checkFolders(["/etc/conf", "/var/lib", "/home/"], ["a1", "b1"], existingUsers, results)
   self.assertEqual(4, len(results))
   names = [i['name'] for i in results]
   for item in ['/etc/conf/a1', '/var/lib/a1', '/etc/conf/b1', '/var/lib/b1']:
     self.assertTrue(item in names)
コード例 #3
0
ファイル: TestHostInfo.py プロジェクト: duxia/ambari
 def test_checkFolders(self, path_mock):
     path_mock.return_value = True
     hostInfo = HostInfo()
     results = []
     existingUsers = [{"name": "a1", "homeDir": "/home/a1"}, {"name": "b1", "homeDir": "/home/b1"}]
     hostInfo.checkFolders(["/etc/conf", "/var/lib", "/home/"], ["a1", "b1"], existingUsers, results)
     self.assertEqual(4, len(results))
     names = [i["name"] for i in results]
     for item in ["/etc/conf/a1", "/var/lib/a1", "/etc/conf/b1", "/var/lib/b1"]:
         self.assertTrue(item in names)
コード例 #4
0
  def test_checkFolders(self, path_mock):
    path_mock.return_value = True
    hostInfo = HostInfo()
    results = []
    existingUsers = [{'name':'a1', 'homeDir':os.path.join('home', 'a1')}, {'name':'b1', 'homeDir':os.path.join('home', 'b1')}]
    hostInfo.checkFolders([os.path.join("etc", "conf"), os.path.join("var", "lib"), "home"], ["a1", "b1"], ["c","d"], existingUsers, results)
    print results
    self.assertEqual(6, len(results))
    names = [i['name'] for i in results]
    for item in [os.path.join('etc','conf','a1'), os.path.join('var','lib','a1'), os.path.join('etc','conf','b1'), os.path.join('var','lib','b1')]:

      self.assertTrue(item in names)