Coverage for webapp/endpoints/snap_search.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.10.2, created at 2025-08-05 22:06 +0000

1import flask 

2from flask.json import jsonify 

3from canonicalwebteam.store_api.dashboard import Dashboard 

4 

5# Local 

6from webapp.decorators import login_required, exchange_required 

7from webapp.helpers import api_session 

8 

9dashboard = Dashboard(api_session) 

10 

11snap_search = flask.Blueprint("snap_search", __name__) 

12 

13 

14@snap_search.route("/api/<store_id>/snaps/search") 

15@login_required 

16@exchange_required 

17def get_snaps_search(store_id): 

18 snaps = dashboard.get_store_snaps( 

19 flask.session, 

20 store_id, 

21 flask.request.args.get("q"), 

22 flask.request.args.get("allowed_for_inclusion"), 

23 ) 

24 

25 return jsonify(snaps)