Ejemplo n.º 1
0
 def check(self, license_id, access_constraints, expected_data, expected_errors):
     errors = {}
     data = {('license_id',):license_id,
             ('access_constraints',):access_constraints}
     errors = {('license_id',):None,
             ('access_constraints',):None}
     validate_license(key=None, data=data, errors=errors, context=None)
     assert_equal(data, expected_data)
     assert_equal(errors, expected_errors)
Ejemplo n.º 2
0
 def check(self, license_id, licence, in_form, expected_data, expected_errors):
     errors = {}
     # The form submits a different key for the licence extra to that which
     # you'd supply when using the API (e.g. doing package_update during
     # harvesting). This is because the validation wants to know whether you
     # are using the form or not since it uses slightly different validation.
     licence_key = "licence_in_form" if in_form else "licence"
     data = {("license_id",): license_id, (licence_key,): licence}
     errors = {("license_id",): None}
     validate_license(key=None, data=data, errors=errors, context=None)
     assert_equal(data, expected_data)
     assert_equal(errors, expected_errors)