Improvements for the API
This commit is contained in:
Родитель
3e26c40c42
Коммит
3e976845bc
15
validate.py
15
validate.py
|
@ -1,16 +1,25 @@
|
|||
from cStringIO import StringIO
|
||||
import json
|
||||
from StringIO import StringIO
|
||||
|
||||
import validator.main
|
||||
import validator.testcases.targetapplication
|
||||
from validator.errorbundler import ErrorBundle
|
||||
from validator.constants import PACKAGE_ANY
|
||||
|
||||
|
||||
def validate(path, format="json"):
|
||||
def validate(path, format="json", approved_applications="", determined=True):
|
||||
"Perform validation in one easy step!"
|
||||
|
||||
output = StringIO()
|
||||
|
||||
# Load up the target applications
|
||||
validator.testcases.targetapplication.APPROVED_APPLICATIONS = \
|
||||
json.loads(open(approved_applications if
|
||||
approved_applications else
|
||||
"validator/app_versions.json").read())
|
||||
|
||||
bundle = ErrorBundle(pipe=output, no_color=True, listed=True)
|
||||
bundle = ErrorBundle(pipe=output, no_color=True, listed=True,
|
||||
determined=determined)
|
||||
validator.main.prepare_package(bundle, path, PACKAGE_ANY)
|
||||
|
||||
# Write the results to the pipe
|
||||
|
|
Загрузка…
Ссылка в новой задаче