tentatively package unittests in rpm sfa-tests, for the nightlies
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 19 Oct 2010 14:02:50 +0000 (17:02 +0300)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 19 Oct 2010 14:02:50 +0000 (17:02 +0300)
.gitignore
Makefile
sfa.spec
tests/testXrn.py

index 302bd96..1b02ac7 100644 (file)
@@ -1,2 +1,4 @@
+.gitignore
 build/*
-*.pyc
\ No newline at end of file
+*.pyc
+TAGS
index eaa6b3c..2446adc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,15 +5,15 @@
 DESTDIR="/"
 
 ##########
-all: python wsdl
+all: python wsdl 
 
-install: python-install wsdl-install xmlbuilder-install 
+install: python-install wsdl-install xmlbuilder-install tests-install
 
-clean: python-clean wsdl-clean
+clean: python-clean wsdl-clean 
 
-uninstall: python-uninstall
+uninstall: python-uninstall tests-uninstall
 
-.PHONY: all install clean 
+.PHONY: all install clean uninstall
 
 ##########
 python: 
@@ -43,6 +43,17 @@ wsdl-clean:
 
 .PHONY: wsdl wsdl-install wsdl-clean
 
+
+##########
+tests-install:
+       mkdir -p $(DESTDIR)/usr/share/sfa/tests
+       install -m 755 tests/*.py $(DESTDIR)/usr/share/sfa/tests/
+
+tests-uninstall:
+       rm -rf $(DESTDIR)/usr/share/sfa/tests
+
+.PHONY: tests-install tests-uninstall
+
 ########## refreshing methods package metafile
 # Metafiles - manage Legacy/ and Accessors by hand
 init := sfa/methods/__init__.py 
index c11fa23..b99b8ed 100644 (file)
--- a/sfa.spec
+++ b/sfa.spec
@@ -52,7 +52,7 @@ Requires: python-dateutil
 #%endif
 
 %package cm
-Summary: the SFA wrapper around MyPLC's NodeManager
+Summary: the SFA wrapper around MyPLC NodeManager
 Group: Applications/System
 Requires: sfa
 Requires: pyOpenSSL >= 0.6
@@ -76,6 +76,11 @@ Summary: sfatables policy tool for SFA
 Group: Applications/System
 Requires: sfa
 
+%Package tests
+Summary: unit tests suite for SFA
+Group: Applications/System
+Requires: sfa
+
 %description
 This package provides the python libraries that the SFA implementation requires
 
@@ -96,6 +101,9 @@ sfatables is a tool for defining access and admission control policies
 in an SFA network, in much the same way as iptables is for ip
 networks. This is the command line interface to manage sfatables
 
+%description tests
+Provides some binary unit tests in /usr/share/sfa/tests
+
 %prep
 %setup -q
 
@@ -147,6 +155,9 @@ rm -rf $RPM_BUILD_ROOT
 %files sfatables
 %{_bindir}/sfatables
 
+%files tests
+%{_datadir}/sfa/tests
+
 ### sfa-plc installs the 'sfa' service
 %post plc
 chkconfig --add sfa
index 9725652..582ebe6 100755 (executable)
@@ -69,7 +69,19 @@ class TestXrn(unittest.TestCase):
     def test_hrn010(self):
         self.__hrn("plc.vini.site", 'authority',
                    "urn:publicid:IDN+plc:vini:site+authority+sa" )
-        
+
+    # this one is a bit off limits but it's used in some places
+    # like .e.g when running sfi.py resources
+    def test_void(self):
+        void=Xrn(xrn='',type=None)
+        expected='urn:publicid:IDN++'
+        self.assertEqual(void.get_hrn(),'')
+        self.assertEqual(void.get_type(),None)
+        self.assertEqual(void.get_urn(),expected)
+        loop=Xrn(urn=expected)
+        self.assertEqual(loop.get_hrn(),'')
+        # xxx - this is not quite right as the first object has type None
+        self.assertEqual(loop.get_type(),'')        
 
     
     def test_host001 (self):
@@ -94,14 +106,14 @@ class TestXrn(unittest.TestCase):
 
     def test_login_base_001 (self):
         xrn=PlXrn(hrn='ple.inria.omftest',type='slice')
-        self.assertEqual(xrn.login_base(),'inria')
+        self.assertEqual(xrn.pl_login_base(),'inria')
 
     def test_slicename_001 (self):
         xrn=PlXrn(hrn='ple.inria.omftest',type='slice')
-        self.assertEqual(xrn.slicename(),'inria_omftest')
+        self.assertEqual(xrn.pl_slicename(),'inria_omftest')
 
     def test_authname_001 (self):
         xrn=PlXrn(hrn='ple.inria.omftest',type='slice')
-        self.assertEqual(xrn.authname(),'inria')
+        self.assertEqual(xrn.pl_authname(),'inria')