summaryrefslogtreecommitdiff
path: root/test-cli/test/helpers/setup_xml.py
diff options
context:
space:
mode:
authorManel Caro <mcaro@iseebcn.com>2019-03-09 21:25:56 +0100
committerManel Caro <mcaro@iseebcn.com>2019-03-09 21:25:56 +0100
commit9332c933fc05f42882640c9a4e35fab09854af84 (patch)
tree2b9b00b5a411b27f9705603c0d93b8925afd4677 /test-cli/test/helpers/setup_xml.py
downloadboard-9332c933fc05f42882640c9a4e35fab09854af84.zip
board-9332c933fc05f42882640c9a4e35fab09854af84.tar.gz
board-9332c933fc05f42882640c9a4e35fab09854af84.tar.bz2
Board: Client Test Suite Initial Commit
Diffstat (limited to 'test-cli/test/helpers/setup_xml.py')
-rw-r--r--test-cli/test/helpers/setup_xml.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/test-cli/test/helpers/setup_xml.py b/test-cli/test/helpers/setup_xml.py
new file mode 100644
index 0000000..3fd9fd5
--- /dev/null
+++ b/test-cli/test/helpers/setup_xml.py
@@ -0,0 +1,40 @@
+import xml.etree.ElementTree as XMLParser
+
+class XMLSetup (object):
+ """aaaaa"""
+ __tree = None # Parser
+ __dbType = None # database connection required: PgSQLConnection
+ __dbConnectionRaw = None # Connection string in raw
+ __dbConnectionStr = None # Connection string to use in sql object connection
+
+ def __init__(self, filename):
+ """aaaaa"""
+ self.__tree = XMLParser.parse(filename)
+
+ def __del__(self):
+ """aaaaa"""
+ pass
+
+ def getdbConnectionStr (self):
+ """aaaaa"""
+ if self.__dbConnectionRaw is not None:
+ return self.__dbConnectionRaw
+
+ for element in self.__tree.iter('db'):
+ self.__dbConnectionRaw = element.attrib
+ self.__dbType = self.__dbConnectionRaw['type']
+ if self.__dbType == "PgSQLConnection":
+ self.__dbConnectionStr = self.getPostgresConnectionStr()
+ return self.__dbConnectionStr
+
+ return None
+
+ def getPostgresConnectionStr (self):
+ """aaaaa"""
+ str = self.__dbConnectionRaw
+ del str['type']
+ return str
+
+ def getMysqlConnectionStr (self):
+ """aaaaa"""
+ pass \ No newline at end of file