def test_check_params_with_empty_mandatory(self): req = Request(self.event_params, '0fa8fc8f-b04a-11e6-b8ed-6dda0ca82a80') err, res = req.check_params({'foo': ''}, ['foo'], []) assert res is None self.assertEqual('Empty or missing mandatory parameter(s): foo', str(err))
def test_check_params_ignores_extras(self): params = { 'mandatory': 'foo', 'optional': 'bar', 'extra': 'baz', } req = Request(self.event_params, '0fa8fc8f-b04a-11e6-b8ed-6dda0ca82a80') err, res = req.check_params(params, ['mandatory'], ['optional']) assert res is not None assert 'extra' not in res
def test_check_params_with_missing_optional(self): req = Request(self.event_params, '0fa8fc8f-b04a-11e6-b8ed-6dda0ca82a80') err, res = req.check_params({}, [], ['optional']) assert res is not None assert err is None