updated microtest
[sfa.git] / sfa / rspecs / version_manager.py
index 2eabaa4..8c00664 100644 (file)
@@ -35,7 +35,7 @@ class VersionManager:
                         ### sounds like we should be glad with the first match, not the last one
                         break
         if not retval:
-            raise UnvalidRSpecVersion("%s %s is not suported here"% (type, version_num, content_type))
+            raise UnsupportedRSpecVersion("[%s %s %s] is not suported here"% (type, version_num, content_type))
         return retval
 
     def get_version(self, version=None):
@@ -69,11 +69,23 @@ class VersionManager:
             raise InvalidRSpec("Unkwnown RSpec schema: %s" % schema)
         return retval
 
+def show_by_string(string):
+    try:
+        print v.get_version(string)
+    except Exception,e:
+        print e
+def show_by_schema(string):
+    try:
+        print v.get_version_by_schema(string)
+    except Exception,e:
+        print e
+
 if __name__ == '__main__':
     v = VersionManager()
     print v.versions
-    print v.get_version('sfa 1') 
-    print v.get_version('protogeni 2') 
-    print v.get_version('protogeni 2 advertisement') 
-    print v.get_version_by_schema('http://www.protogeni.net/resources/rspec/2/ad.xsd') 
+    show_by_string('sfa 1') 
+    show_by_string('protogeni 2') 
+    show_by_string('protogeni 2 advertisement') 
+    show_by_schema('http://www.protogeni.net/resources/rspec/2/ad.xsd') 
+    show_by_schema('http://sorch.netmode.ntua.gr/ws/RSpec/ad.xsd')