def test_missing_file(self): package_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'test_validation_missfile') expected = [(5, "Missing Source Files", "The source file(s) under the tag file " "weren't found inside the package.", 'file')] assert validation.check_for_errors(package_path) == expected
def test_empty_source(self): package_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'test_validation_emptysource') expected = [ (5, "Empty Source Fields", "The source folder(s) under the tag file were empty.", 'file') ] assert validation.check_for_errors(package_path) == expected
def test_missing_image(self): package_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'test_validation_missimage') expected = [ (2, "Empty Installer", "The installer is empty.", 'config'), (4, "Missing Images", "The image(s) under the tag moduleImage " "weren't found inside the package.", 'moduleImage') ] assert validation.check_for_errors(package_path) == expected
def test_flag_value_mismatch(self): package_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'test_validation_flaglabel') expected = [ (5, "Mismatched Flag Labels", "The flag label that flagDependency is dependent on " "is never created during installation.", 'flagDependency'), (5, "Mismatched Flag Values", "The flag value that flagDependency is dependent on " "is never set.", 'flagDependency') ] assert validation.check_for_errors(package_path) == expected
def test_empty_inst(self): package_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'test_validation_empty') expected = [(2, "Empty Installer", "The installer is empty.", 'config') ] assert validation.check_for_errors(package_path) == expected
def test_invalid_arg(self, tmpdir): with pytest.raises(ValueError): validation.check_for_errors(str(tmpdir))
def test_path(self, example_fomod): assert not validation.check_for_errors(example_fomod) assert not validation.check_for_errors( os.path.join(example_fomod, 'fomod'))
def test_list(self, simple_parse): assert not validation.check_for_errors(list(simple_parse)) simple_parse = (etree.ElementTree(simple_parse[0]), etree.ElementTree(simple_parse[1])) assert not validation.check_for_errors(list(simple_parse))
def test_root(self): with pytest.raises(NotImplementedError): validation.check_for_errors(parser.Root())