コード例 #1
0
def test_execute(_mock_get, _mock_post):
    """Test the function execute."""
    f = open("tests/data/stack_aggregator_execute_input.json", "r")
    payload = json.loads(f.read())

    s = stack_aggregator.StackAggregator()
    out = s.execute(payload, False)
    assert out['stack_aggregator'] == "success"
コード例 #2
0
def test_execute(_mock_get, _mock_post):
    """Test the function execute."""
    with open("tests/data/stack_aggregator_execute_input.json", "r") as f:
        payload = json.loads(f.read())

    s = stack_aggregator.StackAggregator()
    out = s.execute(payload, False)
    assert out['stack_aggregator'] == "success"
    assert out['result']['stack_data'][0]['user_stack_info']['transitive_count'] == -1
コード例 #3
0
def test_execute_unknown_with_disable_unknown_package_flow(_mock_unknown, _mock_get,
                                                           _mock_post, monkeypatch):
    """Test the function execute."""
    with open("tests/data/stack_aggregator_execute_input.json", "r") as f:
        payload = json.loads(f.read())

    # add unknown package as direct dependency
    payload['result'][0]['details'][0]['_resolved'].append({'package': 'six', 'version': '3.2.1'})

    monkeypatch.setenv('DISABLE_UNKNOWN_PACKAGE_FLOW', '1')
    s = stack_aggregator.StackAggregator()
    out = s.execute(payload, False)
    assert out['stack_aggregator'] == "success"
    assert out['result']['stack_data'][0]['user_stack_info']['transitive_count'] == -1
    _mock_unknown.assert_not_called()
コード例 #4
0
def test_stack_aggregator_constructor():
    """Test the constructor for the StackAggregator class."""
    obj = stack_aggregator.StackAggregator()
    assert obj