[Commits] (pavlov) adding an isOnline() function to the unit tests to check if you are connected to the net or not

commits at osafoundation.org commits at osafoundation.org
Thu Aug 19 15:20:31 PDT 2004


Commit by: pavlov
Modified files:
chandler/parcels/osaf/contentmodel/tests/TestContentModel.py 1.21 1.22

Log message:
adding an isOnline() function to the unit tests to check if you are connected to the net or not


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/contentmodel/tests/TestContentModel.py.diff?r1=text&tr1=1.21&r2=text&tr2=1.22

Index: chandler/parcels/osaf/contentmodel/tests/TestContentModel.py
diff -u chandler/parcels/osaf/contentmodel/tests/TestContentModel.py:1.21 chandler/parcels/osaf/contentmodel/tests/TestContentModel.py:1.22
--- chandler/parcels/osaf/contentmodel/tests/TestContentModel.py:1.21	Mon Jul 19 13:33:50 2004
+++ chandler/parcels/osaf/contentmodel/tests/TestContentModel.py	Thu Aug 19 15:20:30 2004
@@ -2,8 +2,8 @@
 Basic Unit tests for contentmodel
 """
 
-__revision__  = "$Revision: 1.21 $"
-__date__      = "$Date: 2004/07/19 20:33:50 $"
+__revision__  = "$Revision: 1.22 $"
+__date__      = "$Date: 2004/08/19 22:20:30 $"
 __copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -31,6 +31,15 @@
 
         self.loadParcel("http://osafoundation.org/parcels/osaf/framework/notifications/schema")
 
+
+    def isOnline(self):
+        import socket
+        try:
+            a = socket.gethostbyname('www.osafoundation.org')
+            return True
+        except:
+            return False
+
 class ContentItemTest(ContentModelTestCase):
 
     def testContentItem(self):



More information about the Commits mailing list