Exemplo n.º 1
0
def test_put_process_cve_fail(mock_gremlin, mock_pv):
    """Test the CVEPut.process() success."""
    mock_pv.return_value = [], True, {}
    mock_gremlin.side_effect = [RequestsMockResponse({}, 200),
                                RequestsMockResponse({}, 200),
                                RequestsMockResponse({}, 500),
                                RequestsMockResponse({}, 200)]

    cve = CVEPut(valid_put_input)
    cve.process()
Exemplo n.º 2
0
def cves_put_delete():
    """Put or delete CVE nodes.

    Missing EPVs will be created.
    """
    payload = request.get_json(silent=True)
    try:
        if request.method == 'PUT':
            cve = CVEPut(payload)
        elif request.method == 'DELETE':
            cve = CVEDelete(payload)
        else:
            # this should never happen
            return flask.jsonify({'error': 'method not allowed'}), 405
    except ValueError as e:
        return flask.jsonify({'error': str(e)}), 400

    try:
        cve.process()
    except ValueError as e:
        return flask.jsonify({'error': str(e)}), 500

    return flask.jsonify({}), 200
def test_put_process_epv_fail(mock_pv):
    """Test the CVEPut.process() fail."""
    mock_pv.return_value = [], False, {}

    cve = CVEPut(valid_put_input)
    cve.process()