def test_account_g02(self): """ account_g02 """ account = { "user": [ { "name": "admin", "group": "admin", "password": "******" }, { "name": "monitor", "group": "monitor", "password": "******" } ] } self.maxDiff = None e = ml_w_account.set(None, account) self.assertTrue(e[0], e[1]) f = open(os.path.join("running", "account.txt"), "r") e = f.readlines() f.close() if "json" == ml_system.CFG_TYPE: self.assertEqual(e, ['{"user": [{"password": "******", "group": "admin", "name": "admin"}, {"password": "******", "group": "monitor", "name": "monitor"}]}']) if "jcfg" == ml_system.CFG_TYPE: self.assertEqual(e, ['account {\n', ' user-array {\n', ' user { #1\n', ' name admin\n', ' password 1234\n', ' }\n', ' user { #2\n', ' name monitor\n', ' group monitor\n', ' password 5678\n', ' }\n', ' }\n', '}\n'])
def run(self): e = ml_w_account.set(None, account, threading.RLock())