Пример #1
0
def comment_report():
    claims = get_jwt_claims()
    user = User.from_claims(claims)
    try:
        if check_admin(user):
            result = most_active_commenters()
            return jsonify({'report': result}), 200
        else:
            return jsonify({'status': 'fail'}), 401
    except Exception as e:
        return jsonify({'status': 'fail', 'error': str(e)}), 500
Пример #2
0
def comment_report():
    claims = get_jwt_claims()
    user = User.from_claims(claims)
    try:
        if check_admin(user):
            result = most_active_commenters()
            return jsonify({"report": result}), 200
        else:
            return jsonify({"status": "fail"}), 401
    except Exception as e:
        return jsonify({"status": "fail", "error": str(e)}), 500
def test_cast_popularity(client):
    result = most_active_commenters()
    assert len(result) == 20
def test_check_report(client):
    result = most_active_commenters()
    assert {
        '_id': '*****@*****.**',
        'count': 909
    } in result
Пример #5
0
def test_check_report(client):
    result = most_active_commenters()
    assert {
        "_id": "*****@*****.**",
        "count": 331
    } in result