Example #1
0
    def __init__(self):
        ProcessingPlugin.__init__(self)

        self.id = 'scamp'
        self.optionLabel = 'Scamp'
        self.description = 'Astro-Photo calibration'
        # Item prefix in processing cart. This should be short string since
        # the item ID can be prefixed by a user-defined string
        self.itemPrefix = 'SCAMP'
        self.index = 20

        self.template = 'plugins/scamp.html'                        # Main template, rendered in the processing page
        self.itemCartTemplate = 'plugins/scamp_item_cart.html'      # Template for custom rendering into the processing cart
        self.jsSource = 'plugins/scamp.js'                          # Custom javascript
        self.isAstromatic = True                                    # Part of the www.astromatic.net software suite (Scamp, Swarp, Sextractor...)
Example #2
0
	def __init__(self):
		ProcessingPlugin.__init__(self)

		self.id = 'fitsout'
		self.optionLabel = 'Last Quality Evaluation'
		self.description = 'QualiyFits-Out processing'
		# Item prefix in processing cart. This should be short string since
		# the item ID can be prefixed by a user-defined string
		self.itemPrefix = 'QFO'
		self.index = 40

		# Template for custom rendering into the processing cart
		self.itemCartTemplate = 'plugin_qualityfitsout_item_cart.html'
		# Custom javascript
		self.jsSource = 'plugin_qualityfitsout.js'
Example #3
0
    def __init__(self):
        ProcessingPlugin.__init__(self)
        #
        # REQUIRED members (see doc/writing_plugins/writing_plugins.pdf)
        #
        self.id = "sex"
        self.optionLabel = "Sextractor"
        self.description = "Sources extractor"
        # Item prefix in processing cart. This should be short string since
        # the item ID can be prefixed by a user-defined string
        self.itemPrefix = "SEX"
        self.index = 1

        self.template = "plugins/sextractor.html"  # Main template, rendered in the processing page
        self.itemCartTemplate = (
            "plugins/sextractor_item_cart.html"
        )  # Template for custom rendering into the processing cart
        self.jsSource = "plugins/sextractor.js"  # Custom javascript
        self.isAstromatic = True  # Part of the www.astromatic.net software suite (Scamp, Swarp, Sextractor...)
Example #4
0
    def __init__(self):
        ProcessingPlugin.__init__(self)

        self.id = "skel"
        self.optionLabel = "Skeleton"
        self.description = "Skeleton (Tutorial only)"
        # Item prefix in processing cart. This should be short string since
        # the item ID can be prefixed by a user-defined string
        self.itemPrefix = "SKEL"
        self.index = 65535

        self.template = "plugins/skeleton.html"  # Main template, rendered in the processing page
        self.itemCartTemplate = (
            "plugins/skeleton_item_cart.html"
        )  # Template for custom rendering into the processing cart
        self.jsSource = "plugins/skeleton.js"  # Custom javascript

        # Will queue jobCount jobs on the cluster
        self.jobCount = 5
        self.command = "/usr/bin/uptime"
Example #5
0
 def setUp(self):
     self.plugin = ProcessingPlugin()
Example #6
0
class ProcessingPluginTest(unittest.TestCase):
    """
    Tests the ProcessingPlugin class
    """
    def setUp(self):
        self.plugin = ProcessingPlugin()

    def test_getUniqueCondorJobId(self):
        id = self.plugin.getUniqueCondorJobId()
        self.assertEquals(type(id), types.StringType)
        # Tests pseudo randomness
        self.assertNotEquals(id, self.plugin.getUniqueCondorJobId())

    def test_getConfigValue(self):
        for k in ({'k': 0}, lambda x: x, 1, object()):
            self.assertRaises(TypeError, self.plugin.getConfigValue, k, 'KEYWORD')
            self.assertRaises(TypeError, self.plugin.getConfigValue, [], k)

        content = ['nop nop nop', 'KEYWORD1 VALUE1']
        w = self.plugin.getConfigValue(content, 'wrongkey')
        v = self.plugin.getConfigValue(content, 'KEYWORD1')
        self.assertEquals(type(w), types.BooleanType)
        self.assertEquals(w, False)

        self.assertEquals(type(v), types.StringType)
        self.assertEquals(v, 'VALUE1')
        self.assertEquals(self.plugin.getConfigValue([], 'key'), False)

    def test_reports(self):
        self.assertEquals(type(self.plugin.reports()), types.ListType)

    def test_getUserResultsOutputDir_param_request(self):
        req = HttpRequest()
        self.assertRaises(TypeError, self.plugin.getUserResultsOutputDir, 0)        # request

    def test_getUserResultsOutputDir_param_oldpath(self):
        req = HttpRequest()
        req.user = type('User', (object,), {'username': '******'})()
        self.assertRaises(TypeError, self.plugin.getUserResultsOutputDir, req, 1)   # oldPath

    def test_getUserResultsOutputDir_param_oldusername(self):
        req = HttpRequest()
        self.assertRaises(TypeError, self.plugin.getUserResultsOutputDir, req, 'path', 0)   # oldUserName

    def test_getUserResultsOutputDir_param_missing_oldusername(self):
        req = HttpRequest()
        self.assertRaises(TypeError, self.plugin.getUserResultsOutputDir, req, 'path')  # Missing oldUserName

    def test_getUserResultsOutputDir_ret_type(self):
        req = HttpRequest()
        req.user = type('User', (object,), {'username': '******'})()
        res = self.plugin.getUserResultsOutputDir(req)
        self.assertEquals(type(res), types.StringType)

    def test_getUserResultsOutputDir_ret_value(self):
        req = HttpRequest()
        req.user = type('User', (object,), {'username': '******'})()
        res = self.plugin.getUserResultsOutputDir(req, '/my/path/olduser/', 'olduser')
        self.assertEquals(res, '/my/path/user/')

    def test_setDefaultCleanupFiles(self):
        for k in ([1], lambda x: x, 1, object()):
            self.assertRaises(TypeError, self.plugin.setDefaultCleanupFiles, k)

        ud = self.plugin.setDefaultCleanupFiles({})
        self.assertEquals(type(ud), types.DictType)
        self.assertTrue(ud.has_key('RemoveFiles'))
        self.assertEquals(type(ud['RemoveFiles']), types.ListType)
        for pattern in ud['RemoveFiles']:
            self.assertEquals(type(pattern), types.StringType)

    def test_getConfigFileContent(self):
        pass