Beispiel #1
0
    def test_ReadError(self):
        spec = PluginSpec()
        self.assertEqual(spec.state, PluginSpec.Invalid)
        self.assertFalse(spec.read("non-existing-file.plugin"))
        self.assertEqual(spec.state, PluginSpec.Invalid)
        self.assertTrue(spec.hasError)
        self.assertTrue(spec.errorString)

        self.assertFalse(spec.read(self.testPath + "testspecs/noname.plugin"))
        self.assertEqual(spec.state, PluginSpec.Invalid)
        self.assertTrue(spec.hasError)
        self.assertTrue(spec.errorString)

        self.assertFalse(spec.read(self.testPath + "testspecs/noversion.plugin"))
        self.assertEqual(spec.state, PluginSpec.Invalid)
        self.assertTrue(spec.hasError)
        self.assertTrue(spec.errorString)

        self.assertFalse(spec.read(self.testPath + "testspecs/malformed_json1.plugin"))
        self.assertEqual(spec.state, PluginSpec.Invalid)
        self.assertTrue(spec.hasError)
        self.assertTrue(spec.errorString)

        self.assertFalse(spec.read(self.testPath + "testspecs/malformed_json2.plugin"))
        self.assertEqual(spec.state, PluginSpec.Invalid)
        self.assertTrue(spec.hasError)
        self.assertTrue(spec.errorString)

        self.assertFalse(spec.read(self.testPath + "testspecs/malformed_version.plugin"))
        self.assertEqual(spec.state, PluginSpec.Invalid)
        self.assertTrue(spec.hasError)
        self.assertTrue(spec.errorString)

        self.assertFalse(spec.read(self.testPath + "testspecs/dependencyerror.plugin"))
        self.assertEqual(spec.state, PluginSpec.Invalid)
        self.assertTrue(spec.hasError)
        self.assertTrue(spec.errorString)

        self.assertFalse(spec.read(self.testPath + "testspecs/dependencyerror2.plugin"))
        self.assertEqual(spec.state, PluginSpec.Invalid)
        self.assertTrue(spec.hasError)
        self.assertTrue(spec.errorString)

        self.assertFalse(spec.read(self.testPath + "testspecs/spec_wrong5.plugin"))
        self.assertEqual(spec.state, PluginSpec.Invalid)
        self.assertTrue(spec.hasError)
        self.assertTrue(spec.errorString)
Beispiel #2
0
 def test_Read(self):
     ps = PluginSpec()
     self.assertTrue(ps.state == PluginSpec.Invalid)
     ps.read(path.join(self.testPath + "testspecs/test1.plugin"))
     self.assertEqual(ps.state, PluginSpec.Read)
     self.assertFalse(ps.hasError)
     self.assertEqual(ps.errorString, "")
     self.assertEqual(ps.name, "Test1")
     self.assertEqual(ps.version, "2.2.3b9")
     self.assertEqual(ps.compatVersion, "2.0")
     self.assertEqual(ps.isExperimental, False)
     self.assertEqual(ps.isEnabledInSettings, True)
     self.assertEqual(ps.vendor, "Yippie!")
     self.assertEqual(ps.copyright, "CopyLeft")
     self.assertEqual(ps.license, "GPL8")
     self.assertEqual(ps.description, "The Test plugin for MedUX.")
     self.assertEqual(ps.author, "Mr.Nobody")
     self.assertEqual(ps.url, "http://www.hui.att")
Beispiel #3
0
 def test_Experimental(self):
     spec = PluginSpec()
     self.assertTrue(spec.read(self.testPath + "testspecs/test1_experimental.plugin"))
     self.assertTrue(spec.isExperimental)
     self.assertFalse(spec.isEnabledInSettings)
Beispiel #4
0
    def test_Provides(self):
        spec = PluginSpec() # Version:2.2.3b9, compatVersion:2.0
        self.assertTrue(spec.read(self.testPath + "testspecs/test1.plugin"))
        self.assertFalse(spec.provides("SomeOtherPlugin", "2.2.3b9"))
        self.assertFalse(spec.provides("Test1", "2.2.3b10"))
        self.assertFalse(spec.provides("Test1", "2.2.4"))
        self.assertFalse(spec.provides("Test1", "2.3.11a1"))
        self.assertFalse(spec.provides("Test1", "2.3"))
        self.assertFalse(spec.provides("Test1", "3.0"))
        self.assertFalse(spec.provides("Test1", "1.9.9a99"))
        self.assertFalse(spec.provides("Test1", "1.9"))
        self.assertFalse(spec.provides("Test1", "1.0"))
        self.assertFalse(spec.provides("Test1", "0.9"))

        self.assertTrue(spec.provides("test1", "2.2.3b9"))
        self.assertTrue(spec.provides("Test1", "2.2.3b8"))
        self.assertTrue(spec.provides("Test1", "2.2.3a9"))
        self.assertTrue(spec.provides("Test1", "2.2.3")) # beta must provide full version
        self.assertTrue(spec.provides("Test1", "2.2.2"))
        self.assertTrue(spec.provides("Test1", "2.1.9"))
        self.assertTrue(spec.provides("Test1", "2.1.2b10")) # compatVesion 2.0!
        self.assertTrue(spec.provides("Test1", "2.0.10"))
        self.assertTrue(spec.provides("Test1", "2.0.0b8"))
        self.assertTrue(spec.provides("Test1", "2.0"))