예제 #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."
         ],
     )
예제 #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])
예제 #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, [])
예제 #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, [])
예제 #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, [])
예제 #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, [])