Esempio n. 1
0
 def test_failures(self):
     errors = ValidateCommand().execute(
         os.path.join(os.path.abspath(os.path.dirname(__file__)),
                      "unloadable_plugin_0classes.py"))
     self.assertListEqual(errors, [
         "Module unloadable_plugin_0classes does not define a BaseStoragePlugin!"
     ])
     errors = ValidateCommand().execute(
         os.path.join(os.path.abspath(os.path.dirname(__file__)),
                      "unloadable_plugin_2classes.py"))
     self.assertListEqual(
         errors,
         [
             "Module unloadable_plugin_2classes defines more than one BaseStoragePlugin: [<class 'unloadable_plugin_2classes.TestPluginOne'>, <class 'unloadable_plugin_2classes.TestPluginTwo'>]!"
         ],
     )
     errors = ValidateCommand().execute(
         os.path.join(os.path.abspath(os.path.dirname(__file__)),
                      "unloadable_plugin_alerts_clash.py"))
     self.assertListEqual(
         errors,
         [
             "Resource class 'Controller': Multiple AlertConditions on the same attribute must be disambiguated with 'id' parameters."
         ],
     )
Esempio n. 2
0
 def test_junk(self):
     src = os.path.join(os.path.abspath(os.path.dirname(__file__)), "junk.not-really-py")
     dst = os.path.join(os.path.abspath(os.path.dirname(__file__)), "junk.py")
     shutil.copy(src, dst)
     errors = ValidateCommand().execute(dst)
     os.remove(dst)
     self.assertEqual(len(errors), 1)
     self.assertTrue(errors[0].startswith("SyntaxError:"), errors[0])
Esempio n. 3
0
 def test_thousand_drives(self):
     errors = ValidateCommand().execute(
         os.path.join(os.path.abspath(os.path.dirname(__file__)),
                      "thousand_drives.py"))
     self.assertListEqual(errors, [])
Esempio n. 4
0
 def test_fake_controller(self):
     dirname = os.path.dirname(__file__) + "/../../../../plugins/"
     errors = ValidateCommand().execute(
         os.path.join(os.path.abspath(dirname), "fake_controller.py"))
     self.assertListEqual(errors, [])
Esempio n. 5
0
 def test_example_package(self):
     dirname = os.path.dirname(
         __file__) + "/../../../../../example_storage_plugin_package/"
     errors = ValidateCommand().execute(
         os.path.join(os.path.abspath(dirname), "example_storage_plugin/"))
     self.assertListEqual(errors, [])
Esempio n. 6
0
 def test_submodule(self):
     errors = ValidateCommand().execute(
         os.path.join(os.path.abspath(os.path.dirname(__file__)),
                      "submodule/loadable_submodule_plugin.py"))
     self.assertListEqual(errors, [])