Adam Litke has uploaded a new change for review.
Change subject: tests: Test schema validity
......................................................................
tests: Test schema validity
Add a simple test case to check schema validity. For now, we just call the
schema parser and make sure it doesn't raise any exceptions.
Change-Id: If7680aaf8eb41546e3a8d38e405c7f9ed8bdd192
Signed-off-by: Adam Litke <agl(a)us.ibm.com>
---
A tests/schemaTests.py
1 file changed, 47 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/10050/1
diff --git a/tests/schemaTests.py b/tests/schemaTests.py
new file mode 100644
index 0000000..3e33d54
--- /dev/null
+++ b/tests/schemaTests.py
@@ -0,0 +1,47 @@
+# Copyright 2012 IBM Corporation.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+from testrunner import VdsmTestCase as TestCaseBase
+import os.path
+import vdsmapi
+from vdsm import constants
+
+
+def findSchema():
+ """
+ Find the API schema file whether we are running tests from the source dir
+ or from the tests install location
+ """
+ scriptdir = os.path.dirname(__file__)
+ localpath = os.path.join(scriptdir, '../vdsm_api/vdsmapi-schema.json')
+ installedpath = os.path.join(constants.P_VDSM, 'vdsmapi-schema.json')
+ for f in localpath, installedpath:
+ if os.access(f, os.R_OK):
+ return f
+ raise Exception("Unable to find schema in %s or %s",
+ localpath, installedpath)
+
+
+class SchemaTest(TestCaseBase):
+ def setUp(self):
+ self.schema = findSchema()
+
+ def testSchemaParse(self):
+ with open(self.schema) as f:
+ vdsmapi.parse_schema(f)
--
To view, visit
http://gerrit.ovirt.org/10050
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If7680aaf8eb41546e3a8d38e405c7f9ed8bdd192
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <agl(a)us.ibm.com>