コード例 #1
0
def test_execute_both_resolved_type(_mock_call_insights, _mock_db):
    """Test the function execute."""
    with open("tests/v2/data/stack_aggregator_combined_input.json", "r") as f:
        payload = json.load(f)

    r = RecommendationTask()
    out = r.execute(arguments=payload, persist=False)
    assert out['recommendation'] == "success"
    r = RecommendationTask()
    out = r.execute(arguments=payload, check_license=True, persist=False)
    assert out['recommendation'] == "success"

    out = r.execute(arguments=payload, persist=True)
    _mock_db.assert_called_once()
コード例 #2
0
def test_execute_empty_resolved(_mock_call_insights, _mock_db):
    """Test the function execute."""
    with open("tests/v2/data/stack_aggregator_empty_resolved.json", "r") as f:
        payload = json.load(f)

    r = RecommendationTask()
    out = r.execute(arguments=payload, persist=False)

    assert out['recommendation'] == "success"
    assert not out["result"]["companion"]
    assert not out["result"]["usage_outliers"]

    r = RecommendationTask()
    out = r.execute(arguments=payload, check_license=True, persist=False)
    assert out['recommendation'] == "success"

    out = r.execute(arguments=payload, persist=True)
    _mock_db.assert_called_once()
コード例 #3
0
def test_execute_with_insights(_mock1, _mock2, _mock3):
    """Test the function execute."""
    with open("tests/v2/data/stack_aggregator_execute_input.json", "r") as f:
        payload = json.load(f)

    r = RecommendationTask()
    out = r.execute(arguments=payload, persist=False, check_license=False)

    assert out['recommendation'] == "success"