def search(query): form = InterestSearchForm(url={'query': query}) if not form.validate(): return json({'message': 'Validation Failed', 'errors': form.errors}, 422) data = Interest.search(form.query, user_id=app.auth.user.id) return json({'interests': data})
def search(query): form = InterestSearchForm(url={'query': query}) if not form.validate(): return json({ 'message': 'Validation Failed', 'errors': form.errors }, 422) data = Interest.search(form.query, user_id=app.auth.user.id) return json({'interests': data})
def testSearch(self): objs = Interest.search('m') self.assertTrue(len(objs) > 0) for obj in objs: self.assertTrue(isinstance(obj, Interest))