summaryrefslogtreecommitdiff
path: root/spec/integration/python
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-03-30 23:05:42 -0600
committermo khan <mo.khan@gmail.com>2020-04-02 00:08:43 -0600
commitbfd7459419921ff37ee500f0698862eea6788675 (patch)
tree9749333a7c8878b833b4642afe3071cf1c14012c /spec/integration/python
parent43bcbbd04342faa497725c5b0be3c6d944d850da (diff)
Reproduce failure with go modules scanning
* Install sudo for existing configurations * Detect dependencies in a gomodules project * Add CHANGELOG entry and bump version * Symlink to $GOPATH for non go modules projects * Remove problematic go get setup
Diffstat (limited to 'spec/integration/python')
-rw-r--r--spec/integration/python/pip_spec.rb18
-rw-r--r--spec/integration/python/pipenv_spec.rb15
2 files changed, 14 insertions, 19 deletions
diff --git a/spec/integration/python/pip_spec.rb b/spec/integration/python/pip_spec.rb
index d22121b..2183dd1 100644
--- a/spec/integration/python/pip_spec.rb
+++ b/spec/integration/python/pip_spec.rb
@@ -9,11 +9,10 @@ RSpec.describe "pip" do
report = runner.scan
- expect(report).not_to be_empty
expect(report).to match_schema(version: '2.0')
expect(report[:version]).to start_with('2')
- expect(report[:dependencies].map { |x| x[:name] }).to include("sentry-sdk")
- expect(find_in(report, 'sentry-sdk')[:licenses]).to match_array(["BSD-4-Clause"])
+ expect(report.dependency_names).to include("sentry-sdk")
+ expect(report.licenses_for('sentry-sdk')).to match_array(["BSD-4-Clause"])
end
end
@@ -39,7 +38,6 @@ RSpec.describe "pip" do
report = runner.scan
- expect(report).not_to be_empty
expect(report).to match_schema(version: '2.0')
expect(report[:version]).to start_with('2')
expect(report[:licenses]).not_to be_empty
@@ -60,7 +58,7 @@ RSpec.describe "pip" do
runner.clone(url, branch: python[:commit])
report = runner.scan(env: environment)
- expect(JSON.pretty_generate(report)).to eq(expected_content)
+ expect(JSON.pretty_generate(report.to_h)).to eq(expected_content)
expect(report).to match_schema(version: report_version)
end
end
@@ -74,7 +72,7 @@ RSpec.describe "pip" do
expect(report).to match_schema(version: '2.0')
expect(report[:dependencies]).not_to be_empty
- expect(find_in(report, 'boto3')[:licenses]).to match_array(['Apache-2.0'])
+ expect(report.licenses_for('boto3')).to match_array(['Apache-2.0'])
end
it 'detects licenses in a more complicated `setup.py`' do
@@ -83,7 +81,7 @@ RSpec.describe "pip" do
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'])
+ expect(report.licenses_for('peppercorn')).to match_array(['BSD-2-Clause'])
end
end
@@ -96,7 +94,7 @@ RSpec.describe "pip" 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, 'six')[:licenses]).to match_array(["MIT"])
+ expect(report.licenses_for('six')).to match_array(["MIT"])
end
end
@@ -109,8 +107,8 @@ RSpec.describe "pip" do
report = runner.scan(env: { 'SETUP_CMD' => 'pip install -r requirements.txt' })
expect(report).to match_schema(version: '2.0')
- expect(find_in(report, 'six')[:licenses]).to match_array(["MIT"])
- expect(report[:dependencies].map { |x| x[:name] }).to contain_exactly('six')
+ expect(report.licenses_for('six')).to match_array(["MIT"])
+ expect(report.dependency_names).to contain_exactly('six')
end
end
diff --git a/spec/integration/python/pipenv_spec.rb b/spec/integration/python/pipenv_spec.rb
index 983ea8b..410d3c7 100644
--- a/spec/integration/python/pipenv_spec.rb
+++ b/spec/integration/python/pipenv_spec.rb
@@ -24,11 +24,10 @@ RSpec.describe "pipenv" do
report = runner.scan
- expect(report).not_to be_empty
expect(report).to match_schema(version: '2.0')
expect(report[:version]).not_to be_empty
expect(report[:licenses]).not_to be_empty
- expect(report[:dependencies].map { |x| x[:name] }).to contain_exactly("six")
+ expect(report.dependency_names).to contain_exactly("six")
end
end
@@ -71,10 +70,9 @@ RSpec.describe "pipenv" do
report = runner.scan
expect(report).to match_schema(version: '2.0')
- expect(report).not_to be_empty
expect(report[:version]).not_to be_empty
expect(report[:licenses]).not_to be_empty
- expect(report[:dependencies].map { |x| x[:name] }).to match_array([
+ expect(report.dependency_names).to match_array([
"backports.shutil_get_terminal_size",
"click",
"colorama",
@@ -132,10 +130,9 @@ RSpec.describe "pipenv" do
report = runner.scan
expect(report).to match_schema(version: '2.0')
- expect(report).not_to be_empty
expect(report[:version]).not_to be_empty
expect(report[:licenses]).not_to be_empty
- expect(report[:dependencies].map { |x| x[:name] }).to match_array(%w[
+ expect(report.dependency_names).to match_array(%w[
certifi
chardet
idna
@@ -171,7 +168,7 @@ RSpec.describe "pipenv" do
expect(report).to match_schema(version: '2.0')
expect(report[:licenses]).not_to be_empty
expect(report[:dependencies].count).to be(1)
- expect(find_in(report, 'six')).not_to be_nil
+ expect(report.find('six')).not_to be_nil
end
end
@@ -192,13 +189,13 @@ RSpec.describe "pipenv" do
it 'includes dependencies in the default group' do
lockfile_hash['default'].keys.each do |key|
- expect(find_in(report, key)).not_to be_nil
+ expect(report.find(key)).not_to be_nil
end
end
it 'excludes dependencies in the development group' do
lockfile_hash['develop'].keys.each do |key|
- expect(find_in(report, key)).to be_nil
+ expect(report.find(key)).to be_nil
end
end
end