• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

AKSW / QuitStore / 5417129443

pending completion
5417129443

push

github

white-gecko
Fix helper tests

2386 of 3072 relevant lines covered (77.67%)

3.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

97.5
/quit/web/modules/debug.py
1
import traceback
5✔
2

3
from werkzeug.http import parse_accept_header
5✔
4
from flask import Blueprint, request, current_app, make_response
5✔
5
from quit.conf import Feature
5✔
6
from quit.web.app import render_template, feature_required
5✔
7

8
__all__ = ('debug')
5✔
9

10
debug = Blueprint('debug', __name__)
5✔
11

12

13
@debug.route("/blame", defaults={'branch_or_ref': None}, methods=['GET'])
5✔
14
@debug.route("/blame/<branch_or_ref>", methods=['GET'])
5✔
15
@feature_required(Feature.Provenance)
5✔
16
def blame(branch_or_ref):
4✔
17

18
    quit = current_app.config['quit']
5✔
19

20
    if not branch_or_ref and not quit.repository.is_empty:
5✔
21
        branch_or_ref = quit.getDefaultBranch()
×
22

23
    blame = current_app.config['blame']
5✔
24

25
    if 'Accept' in request.headers:
5✔
26
        mimetype = parse_accept_header(request.headers['Accept']).best
5✔
27
    else:
28
        mimetype = 'application/sparql-results+json'
5✔
29

30
    try:
5✔
31
        res = blame.run(branch_or_ref=branch_or_ref)
5✔
32

33
        if mimetype in ['text/html', 'application/xhtml_xml', '*/*']:
5✔
34
            results = [{'commit': quit.repository.revision(
5✔
35
                row['hex']), 'blame': row} for row in res]
36
            response = make_response(render_template("blame.html", results=results,
5✔
37
                                     current_ref=branch_or_ref))
38
            response.headers['Content-Type'] = 'text/html'
5✔
39
            return response
5✔
40
        elif mimetype in ['application/json', 'application/sparql-results+json']:
5✔
41
            response = make_response(res.serialize(format='json'), 200)
5✔
42
            response.headers['Content-Type'] = 'application/json'
5✔
43
            return response
5✔
44
        elif mimetype in [
5✔
45
            'application/rdf+xml', 'application/xml', 'application/sparql-results+xml'
46
        ]:
47
            response = make_response(res.serialize(format='xml'), 200)
5✔
48
            response.headers['Content-Type'] = 'application/rdf+xml'
5✔
49
            return response
5✔
50
        elif mimetype in ['application/csv', 'text/csv']:
5✔
51
            response = make_response(res.serialize(format='csv'), 200)
5✔
52
            response.headers['Content-Type'] = 'text/csv'
5✔
53
            return response
5✔
54
    except Exception as e:
5✔
55
        current_app.logger.error(e)
5✔
56
        current_app.logger.error(traceback.format_exc())
5✔
57
        return "<pre>" + traceback.format_exc() + "</pre>", 400
5✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc