Fix regressions

This commit is contained in:
Alexandre Aubin 2020-10-08 15:01:36 +02:00
parent 89a9eb3f73
commit 961e0bce9f

View file

@ -614,14 +614,20 @@ class Manifest(TestSuite):
@test() @test()
def mandatory_fields(self): def mandatory_fields(self):
fields = ("name", "id", "packaging_format", "description", "url", "version", fields = ("name", "id", "packaging_format", "description", "version",
"license", "maintainer", "requirements", "multi_instance", "maintainer", "requirements", "multi_instance",
"services", "arguments") "services", "arguments")
missing_fields = [field for field in fields if field not in self.manifest.keys()] missing_fields = [field for field in fields if field not in self.manifest.keys()]
if missing_fields: if missing_fields:
yield Error("The following mandatory fields are missing: %s" % missing_fields) yield Error("The following mandatory fields are missing: %s" % missing_fields)
fields = ("license", "url")
missing_fields = [field for field in fields if field not in self.manifest.keys()]
if missing_fields:
yield Warning("The following mandatory fields are missing: %s" % missing_fields)
@test() @test()
def yunohost_version_requirement(self): def yunohost_version_requirement(self):
@ -645,7 +651,7 @@ class Manifest(TestSuite):
return return
def license_mentionned_in_readme(): def license_mentionned_in_readme():
readme_path = os.path.join(app.path, 'README.md') readme_path = os.path.join(self.path, 'README.md')
if os.path.isfile(readme_path): if os.path.isfile(readme_path):
return "LICENSE" in open(readme_path).read() return "LICENSE" in open(readme_path).read()
return False return False
@ -674,13 +680,13 @@ class Manifest(TestSuite):
@test() @test()
def app_in_app_list(self): def app_in_app_catalog(self):
if self.manifest["id"] not in app_list(): if self.manifest["id"] not in app_list():
yield Error("This app is not Yunohost's application catalog") yield Warning("This app is not Yunohost's application catalog")
@test() @test()
def app_in_app_list(self): def app_in_github_org(self):
all_urls = [infos.get("url", "").lower() for infos in app_list().values()] all_urls = [infos.get("url", "").lower() for infos in app_list().values()]
@ -696,7 +702,7 @@ class Manifest(TestSuite):
return urlopen(repo_brique)['code'] != 404 return urlopen(repo_brique)['code'] != 404
if not is_in_github_org() and not is_in_brique_org(): if not is_in_github_org() and not is_in_brique_org():
yield Error("Consider adding your app to the YunoHost-Apps organization to allow the community to contribute more easily") yield Warning("Consider adding your app to the YunoHost-Apps organization to allow the community to contribute more easily")
@test() @test()
def description(self): def description(self):
@ -743,7 +749,7 @@ class Manifest(TestSuite):
@test() @test()
def url(self): def url(self):
if self.manifest["url"].endswith("_ynh"): if self.manifest.get("url", "").endswith("_ynh"):
yield Warning( yield Warning(
"'url' is not meant to be the url of the yunohost package, " "'url' is not meant to be the url of the yunohost package, "
"but rather the website or repo of the upstream app itself..." "but rather the website or repo of the upstream app itself..."