def test_documentation(self): """ Assert that documentation can be retrieved for each imported module """ mods = oxide.modules_list() for mod in mods: fail_msg = "Not able to retrieve documentation for " + mod doc = oxide.documentation(mod) self.assertNotEqual(doc, None, fail_msg)
def test_opts_doc(self): """ Assert that each module that has an opts_doc also has the required fields """ mods = oxide.modules_list() for mod in mods: opts_doc = doc = oxide.documentation(mod)["opts_doc"] for opt in opts_doc: opts_keys = ["type", "mangle", "default"] for opts_key in opts_keys: fail_msg = "opts_doc for module %s missing key %s." % (mod, opts_key) self.assertTrue(opts_doc[opt].has_key(opts_key), fail_msg)
def test_modules_imported(self): """ Assert that all of the modules imported correctly """ fail = False for mod_type in mod_types: mod_type_path = os.path.join(oxide.config.dir_modules,mod_type) if not os.path.isdir(mod_type_path): continue mod_dirs = os.listdir(mod_type_path) base_type = mod_type if base_type[-4:] == "_dev": base_type = base_type[:-4] mods = oxide.modules_list(mod_type=base_type) for mod_dir in mod_dirs: if not os.path.isdir(os.path.join(mod_type_path,mod_dir)): continue fail_msg = "\n * A directory for module %s of type %s exists but it did not import." % (mod_dir, mod_type) if not mod_dir in mods: fail = True print fail_msg self.assertFalse(fail, "Some modules were not imported.")