diff options
| author | mo khan <mo.khan@gmail.com> | 2020-03-20 17:08:23 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-03-26 20:04:48 -0600 |
| commit | 38a2f3123bb4dc6ec2f7479a0e682c92b81a954b (patch) | |
| tree | 16feaf24e3c5ca71bd1c5d93a0504b2e18cf6919 /spec/integration/python/pip_spec.rb | |
| parent | 4db9ccdf7a07654e7d546b5a6ab7467cf3818c93 (diff) | |
Install pip packages from a custom index
* Read PIP_INDEX_URL to identify where to download packages from
Diffstat (limited to 'spec/integration/python/pip_spec.rb')
| -rw-r--r-- | spec/integration/python/pip_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/integration/python/pip_spec.rb b/spec/integration/python/pip_spec.rb index 9c565a9..e54aa19 100644 --- a/spec/integration/python/pip_spec.rb +++ b/spec/integration/python/pip_spec.rb @@ -65,4 +65,37 @@ RSpec.describe "pip" do end end end + + context "when scanning projects with a `setup.py` but do not have a `requirements.txt` files" do + pending 'detects licenses in a simple `setup.py`' do + runner.add_file('setup.py', fixture_file_content('python/simple-setup.py')) + report = runner.scan + + expect(report).to match_schema(version: '2.0') + expect(report[:dependencies]).not_to be_empty + expect(find_in(report, 'boto3')[:licenses]).to match_array(['MIT']) + end + + pending 'detects licenses in a more complicated `setup.py`' do + runner.add_file('setup.py', fixture_file_content('python/complex-setup.py')) + report = runner.scan + + expect(report).to match_schema(version: '2.0') + expect(report[:dependencies]).not_to be_empty + expect(find_in(report, 'peppercorn')[:licenses]).to match_array(['BSD-2-Clause']) + end + end + + context "when scanning projects that have a custom index-url" do + before do + runner.add_file('requirements.txt', 'pip==18.1') + end + + it 'detects the licenses from the custom index' do + report = runner.scan(env: { 'PIP_INDEX_URL' => 'https://test.pypi.org/simple/' }) + + expect(report).to match_schema(version: '2.0') + expect(find_in(report, 'pip')[:licenses]).to match_array(["MIT"]) + end + end end |
