summaryrefslogtreecommitdiffstats
path: root/tests/test-framework/vmware/source.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-framework/vmware/source.py')
-rw-r--r--tests/test-framework/vmware/source.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/test-framework/vmware/source.py b/tests/test-framework/vmware/source.py
new file mode 100644
index 000000000..fe067ab4e
--- /dev/null
+++ b/tests/test-framework/vmware/source.py
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+import os, time
+
+class Installer:
+ def __init__( self, path, platform, location, timestamp=None, tempfile=None ):
+ self.path = path
+ self.platform = platform
+ self.error = None
+ self.timestamp = timestamp
+ self.tempfile = tempfile
+ self.sourceLocation = location
+
+ def markAsTested( self ):
+ self.sourceLocation.markAsTested( self.sourceFilename )
+
+class Source:
+ def __init__( self ):
+ self._dummies = []
+
+ def nextInstaller( self ):
+ if len( self._dummies ) == 0:
+ return None
+ delay, path = self._dummies.pop()
+ time.sleep( delay )
+ if os.path.exists( path ):
+ inst = Installer( path, "linux", None )
+ inst.sourceFilename = path
+ return inst
+ else:
+ inst = Installer( None, None )
+ #simulating download errors
+ inst.error = "Installer '{0}' does not exist".format( path )
+ return inst
+
+ def addDummy( self, delay, path ):
+ self._dummies.insert( 0, ( delay, path ) )