def test_01_Port(self): """ Write Web port. """ # print(PrettyFormatAny.form(self.m_web_obj, 'Web')) webXml._write_port(self.m_web_obj, self.m_web_xml) # print(PrettyFormatAny.form(self.m_web_xml, 'Web')) self.assertEqual(self.m_web_xml.find('Port').text, TESTING_WEB_PORT)
def test_04_Web(self): """ Read all Web info. """ self.m_pyhouse_obj.Computer.Web = webXml.read_web_xml(self.m_pyhouse_obj) l_obj = webXml.read_web_xml(self.m_pyhouse_obj) print(PrettyFormatAny.form(l_obj, 'All Web')) self.assertEqual(l_obj.WebPort, int(TESTING_WEB_PORT)) self.assertEqual(len(l_obj.Logins), 2)
def test_04_Web(self): """ Read all Web info. """ self.m_pyhouse_obj.Computer.Web = webXml.read_web_xml( self.m_pyhouse_obj) l_obj = webXml.read_web_xml(self.m_pyhouse_obj) print(PrettyFormatAny.form(l_obj, 'All Web')) self.assertEqual(l_obj.WebPort, int(TESTING_WEB_PORT)) self.assertEqual(len(l_obj.Logins), 2)
def test_04_Web(self): """ Write All logins. """ l_xml = webXml.write_web_xml(self.m_pyhouse_obj) print(PrettyFormatAny.form(l_xml, 'Web')) self.assertEqual(l_xml.find('Port').text, TESTING_WEB_PORT) self.assertEqual(l_xml.find('LoginSection/Login/FullName').text, TESTING_LOGIN_FULL_NAME_0)
def test_03_AllLogins(self): """ Write All logins. """ l_obj = self.m_web_obj.Logins l_xml = webXml._write_all_logins(l_obj) print(PrettyFormatAny.form(l_xml, 'Web')) self.assertEqual(l_xml.find('Login/FullName').text, TESTING_LOGIN_FULL_NAME_0)
def test_02_ReadXML(self): l_web = webXml.read_web_xml(self.m_pyhouse_obj) self.m_pyhouse_obj.Computer.Web = l_web # print(PrettyFormatAny.form(l_web, 'Web Data')) self.assertEqual(l_web.WebPort, 8580) self.assertEqual(len(l_web.Logins), 2) self.assertEqual(l_web.Logins[0].Name, TESTING_LOGIN_NAME_0)
def test_03_AllLogins(self): """ Write All logins. """ l_obj = self.m_web_obj.Logins l_xml = webXml._write_all_logins(l_obj) print(PrettyFormatAny.form(l_xml, 'Web')) self.assertEqual( l_xml.find('Login/FullName').text, TESTING_LOGIN_FULL_NAME_0)
def setUp(self): SetupMixin.setUp(self, ET.fromstring(XML_LONG)) l_web = webXml.read_web_xml(self.m_pyhouse_obj) self.m_pyhouse_obj.Computer.Web = l_web l_nodes = nodesXml.read_all_nodes_xml(self.m_pyhouse_obj) self.m_pyhouse_obj.Computer.Nodes = l_nodes self.m_worksapce = WorkspaceData self.m_worksapce.m_pyhouse_obj = self.m_pyhouse_obj
def test_04_Web(self): """ Write All logins. """ l_xml = webXml.write_web_xml(self.m_pyhouse_obj) print(PrettyFormatAny.form(l_xml, 'Web')) self.assertEqual(l_xml.find('Port').text, TESTING_WEB_PORT) self.assertEqual( l_xml.find('LoginSection/Login/FullName').text, TESTING_LOGIN_FULL_NAME_0)
def test_03_AllLogins(self): """ Read all login objects. """ l_xml = self.m_xml.web_sect l_obj, l_count = webXml._read_all_logins(l_xml) print(PrettyFormatAny.form(l_xml, 'XML')) print(PrettyFormatAny.form(l_obj, 'All login')) print(PrettyFormatAny.form(l_obj[0], 'All login')) self.assertEqual(l_count, 2) self.assertEqual(len(l_obj), 2)
def test_02_OneLogin(self): """ Read one Login object. """ l_xml = self.m_xml.login_sect.find('Login') l_obj = webXml._read_one_login(l_xml) print(PrettyFormatAny.form(l_xml, 'XML')) print(PrettyFormatAny.form(l_obj, 'One login')) self.assertEqual(l_obj.Name, TESTING_LOGIN_NAME_0) self.assertEqual(l_obj.LoginFullName, TESTING_LOGIN_FULL_NAME_0) self.assertEqual(l_obj.LoginPasswordCurrent, TESTING_LOGIN_PASSWORD_0) self.assertEqual(l_obj.LoginRole, TESTING_LOGIN_ROLE_0)
def test_02_OneLogin(self): """ Write one Login. """ l_obj = self.m_web_obj.Logins[0] # print(PrettyFormatAny.form(l_obj, 'Login Obj')) l_xml = webXml._write_one_login(l_obj) # print(PrettyFormatAny.form(l_xml, 'Web')) self.assertEqual(l_xml.attrib['Name'], TESTING_LOGIN_NAME_0) self.assertEqual(l_xml.attrib['Key'], TESTING_LOGIN_KEY_0) self.assertEqual(l_xml.attrib['Active'], TESTING_LOGIN_ACTIVE_0) self.assertEqual(l_xml.find('FullName').text, TESTING_LOGIN_FULL_NAME_0) self.assertEqual(l_xml.find('Password').text, TESTING_LOGIN_PASSWORD_0) self.assertEqual(l_xml.find('Role').text, TESTING_LOGIN_ROLE_0)
def test_02_OneLogin(self): """ Write one Login. """ l_obj = self.m_web_obj.Logins[0] # print(PrettyFormatAny.form(l_obj, 'Login Obj')) l_xml = webXml._write_one_login(l_obj) # print(PrettyFormatAny.form(l_xml, 'Web')) self.assertEqual(l_xml.attrib['Name'], TESTING_LOGIN_NAME_0) self.assertEqual(l_xml.attrib['Key'], TESTING_LOGIN_KEY_0) self.assertEqual(l_xml.attrib['Active'], TESTING_LOGIN_ACTIVE_0) self.assertEqual( l_xml.find('FullName').text, TESTING_LOGIN_FULL_NAME_0) self.assertEqual(l_xml.find('Password').text, TESTING_LOGIN_PASSWORD_0) self.assertEqual(l_xml.find('Role').text, TESTING_LOGIN_ROLE_0)
def test_01_Port(self): """ Read the web port. """ l_port = webXml._read_port(self.m_xml.web_sect) self.assertEqual(l_port, int(TESTING_WEB_PORT))
def test_03_WriteXML(self): l_web = webXml.read_web_xml(self.m_pyhouse_obj) self.m_pyhouse_obj.Computer.Web = l_web print(PrettyFormatAny.form(l_web, 'Web Data')) l_xml = webXml.write_web_xml(l_web) print(PrettyFormatAny.form(l_xml, 'XML'))
def LoadXml(self, p_pyhouse_obj): l_ret = webXml.read_web_xml(p_pyhouse_obj) return l_ret
def SaveXml(self, p_xml): p_xml.append(webXml.write_web_xml(self.m_pyhouse_obj.Computer.Web)) LOG.info("Saved WebServer XML.")
def test_21_WriteXML(self): l_web = webXml.read_web_xml(self.m_pyhouse_obj) l_xml = webXml.write_web_xml(l_web)
def test_11_ReadXML(self): l_web = webXml.read_web_xml(self.m_pyhouse_obj) self.m_pyhouse_obj.Computer.Logs = l_web self.assertEqual(l_web.WebPort, 8580)
def SaveXml(self, p_xml): l_xml = webXml.write_web_xml(self.m_pyhouse_obj) p_xml.append(l_xml) LOG.info("Saved Web XML.")
def setUp(self): SetupMixin.setUp(self, ET.fromstring(XML_LONG)) self.m_web_obj = webXml.read_web_xml(self.m_pyhouse_obj) self.m_pyhouse_obj.Computer.Web = self.m_web_obj self.m_web_xml = ET.Element("WebSection")
def LoadXml(self, p_pyhouse_obj): """ Load the Mqtt xml info. """ l_ret = webXml.read_web_xml(p_pyhouse_obj) p_pyhouse_obj.Computer.Web = l_ret LOG.info('Loaded XML')