diff options
| author | mo khan <mo.khan@gmail.com> | 2020-08-17 16:23:28 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-08-18 09:27:34 -0600 |
| commit | a54789bcfe9e05ab42dfb6e03457279384e343fe (patch) | |
| tree | 9f0ad8087db423cf57b1e96451a0c977422a50d7 /spec/integration/python/pipenv_spec.rb | |
| parent | 24695063d1ba9a73ba92a44fae0813d5492cf29c (diff) | |
Update license_finder to 6.8.1
* Update CHANGELOG
* Add default retry for all jobs
* Ensure all deb packages are built
Diffstat (limited to 'spec/integration/python/pipenv_spec.rb')
| -rw-r--r-- | spec/integration/python/pipenv_spec.rb | 87 |
1 files changed, 51 insertions, 36 deletions
diff --git a/spec/integration/python/pipenv_spec.rb b/spec/integration/python/pipenv_spec.rb index 5cc9128..cd20522 100644 --- a/spec/integration/python/pipenv_spec.rb +++ b/spec/integration/python/pipenv_spec.rb @@ -1,6 +1,12 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe "pipenv" do + subject { runner.scan(env: env) } + + let(:env) { {} } + include_examples "each report version", "python", "pipenv", "pip-file-lock" context "when a project depends on a version 6 Pipfile.lock" do @@ -19,15 +25,15 @@ RSpec.describe "pipenv" do }) end - it 'produces a valid report' do + before do runner.add_file('Pipfile.lock', pipfile_lock_content) + end - report = runner.scan - - expect(report).to match_schema - expect(report[:version]).not_to be_empty - expect(report[:licenses]).not_to be_empty - expect(report.dependency_names).to contain_exactly("six") + it 'produces a valid report' do + expect(subject).to match_schema + expect(subject[:version]).not_to be_empty + expect(subject[:licenses]).not_to be_empty + expect(subject.dependency_names).to contain_exactly("six") end end @@ -64,15 +70,15 @@ RSpec.describe "pipenv" do }) end - it 'produces a valid report' do + before do runner.add_file('Pipfile.lock', pipfile_lock_content) + end - report = runner.scan - - expect(report).to match_schema - expect(report[:version]).not_to be_empty - expect(report[:licenses]).not_to be_empty - expect(report.dependency_names).to match_array([ + it 'produces a valid report' do + expect(subject).to match_schema + expect(subject[:version]).not_to be_empty + expect(subject[:licenses]).not_to be_empty + expect(subject.dependency_names).to match_array([ "backports.shutil_get_terminal_size", "click", "colorama", @@ -124,15 +130,15 @@ RSpec.describe "pipenv" do }) end - it 'produces a valid report' do + before do runner.add_file('Pipfile.lock', pipfile_lock_content) + end - report = runner.scan - - expect(report).to match_schema - expect(report[:version]).not_to be_empty - expect(report[:licenses]).not_to be_empty - expect(report.dependency_names).to match_array(%w[ + it 'produces a valid report' do + expect(subject).to match_schema + expect(subject[:version]).not_to be_empty + expect(subject[:licenses]).not_to be_empty + expect(subject.dependency_names).to match_array(%w[ certifi chardet idna @@ -163,22 +169,19 @@ RSpec.describe "pipenv" do end it 'produces a valid report' do - report = runner.scan - - expect(report).to match_schema - expect(report[:licenses]).not_to be_empty - expect(report[:dependencies].count).to be(1) - expect(report.find('six')).not_to be_nil + expect(subject).to match_schema + expect(subject[:licenses]).not_to be_empty + expect(subject[:dependencies].count).to be(1) + expect(subject.find('six')).not_to be_nil end end context "when scanning a simple Pipfile project" do - let(:lockfile_content) { fixture_file_content('python/simple-Pipfile.lock') } + let(:lockfile_content) { fixture_file_content('python/pipenv/simple/Pipfile.lock') } let(:lockfile_hash) { JSON.parse(lockfile_content) } before do - runner.add_file('Pipfile', fixture_file_content('python/simple-Pipfile')) - runner.add_file('Pipfile.lock', lockfile_content) + runner.mount(dir: fixture_file('python/pipenv/simple')) end [2, 3].each do |version| @@ -204,6 +207,12 @@ RSpec.describe "pipenv" do context "when connecting to a private package repository with self signed certificate" do let(:index_url) { "https://pypi.test/simple" } + let(:env) do + { + 'ADDITIONAL_CA_CERT_BUNDLE' => x509_certificate('wildcard.test').read, + 'PIP_INDEX_URL' => index_url + } + end before do add_host('pypi.test', '127.0.0.1') @@ -214,13 +223,19 @@ RSpec.describe "pipenv" do end it 'downloads the packages and trusts the certificate' do - report = runner.scan(env: { - 'ADDITIONAL_CA_CERT_BUNDLE' => x509_certificate('wildcard.test').read, - 'PIP_INDEX_URL' => index_url - }) + expect(subject).to match_schema + expect(subject.dependency_names).to include('requests') + end + end + + context "when scanning a project that declares a specific version of python in the lockfile" do + before do + runner.mount(dir: fixture_file('python/pipenv/specific-python-version')) + end - expect(report).to match_schema - expect(report.dependency_names).to include('requests') + specify do + expect(subject).to match_schema + expect(subject.dependency_names).to match_array(%w[Django docutils pytz requests]) end end end |
