summaryrefslogtreecommitdiff
path: root/spec/integration/python/pip_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/integration/python/pip_spec.rb')
-rw-r--r--spec/integration/python/pip_spec.rb54
1 files changed, 28 insertions, 26 deletions
diff --git a/spec/integration/python/pip_spec.rb b/spec/integration/python/pip_spec.rb
index 8e3ec3d..848e873 100644
--- a/spec/integration/python/pip_spec.rb
+++ b/spec/integration/python/pip_spec.rb
@@ -1,8 +1,10 @@
+# frozen_string_literal: true
+
require 'spec_helper'
-RSpec.describe "pip" do
- context "when a project depends on the latest version of pip" do
- let(:requirements) { "sentry-sdk>=0.7.7" }
+RSpec.describe 'pip' do
+ context 'when a project depends on the latest version of pip' do
+ let(:requirements) { 'sentry-sdk>=0.7.7' }
it 'produces a valid report' do
runner.add_file('requirements.txt', requirements)
@@ -11,12 +13,12 @@ RSpec.describe "pip" do
expect(report).to match_schema(version: '2.0')
expect(report[:version]).to start_with('2')
- expect(report.dependency_names).to include("sentry-sdk")
- expect(report.licenses_for('sentry-sdk')).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
- context "when the project has a dependency that depends on a minimum of python 3.6" do
+ context 'when the project has a dependency that depends on a minimum of python 3.6' do
let(:requirements) do
[
'boto3',
@@ -64,7 +66,7 @@ RSpec.describe "pip" do
end
end
- context "when scanning projects with a `setup.py` and does not have a `requirements.txt` file" do
+ context 'when scanning projects with a `setup.py` and does not have a `requirements.txt` file' do
it 'detects licenses in a simple `setup.py`' do
runner.add_file('setup.py', fixture_file_content('python/simple-setup.py'))
report = runner.scan
@@ -84,7 +86,7 @@ RSpec.describe "pip" do
end
end
- context "when scanning projects that have a custom index-url" do
+ context 'when scanning projects that have a custom index-url' do
before do
runner.add_file('requirements.txt', 'six')
end
@@ -93,11 +95,11 @@ 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(report.licenses_for('six')).to match_array(["MIT"])
+ expect(report.licenses_for('six')).to match_array(['MIT'])
end
end
- context "when a project uses a custom `SETUP_CMD`" do
+ context 'when a project uses a custom `SETUP_CMD`' do
before do
runner.add_file('requirements.txt', 'six==1.14.0')
end
@@ -106,20 +108,20 @@ RSpec.describe "pip" do
report = runner.scan(env: { 'SETUP_CMD' => 'pip install -r requirements.txt' })
expect(report).to match_schema(version: '2.0')
- expect(report.licenses_for('six')).to match_array(["MIT"])
+ expect(report.licenses_for('six')).to match_array(['MIT'])
expect(report.dependency_names).to contain_exactly('six')
end
end
- context "when a projects is running in airgap mode" do
+ context 'when a projects is running in airgap mode' do
before do
runner.add_file('requirements.txt', '')
end
it 'is able to scan the project' do
report = runner.scan(env: {
- 'PIP_INDEX_URL' => 'https://localhost/simple/'
- })
+ 'PIP_INDEX_URL' => 'https://localhost/simple/'
+ })
expect(report).to match_schema(version: '2.0')
expect(report[:licenses]).to be_empty
@@ -127,30 +129,30 @@ RSpec.describe "pip" do
end
end
- context "when connecting to a private package repository with self signed certificate" do
+ context 'when connecting to a private package repository with self signed certificate' do
let(:index_url) { "https://#{private_pypi_host}/simple" }
let(:bundle) { fixture_file_content('python/pypi.crt') }
before do
runner.add_file('setup.py') do
<<~RAW
-from setuptools import setup, find_packages
-
-setup(
- name='gitlab-sp-test-python-pip',
- version='1.2.0',
- packages=find_packages(),
- install_requires=['requests'],
-)
+ from setuptools import setup, find_packages
+
+ setup(
+ name='gitlab-sp-test-python-pip',
+ version='1.2.0',
+ packages=find_packages(),
+ install_requires=['requests'],
+ )
RAW
end
end
it 'downloads the packages and trusts the certificate' do
report = runner.scan(env: {
- 'ADDITIONAL_CA_CERT_BUNDLE' => bundle,
- 'PIP_INDEX_URL' => index_url
- })
+ 'ADDITIONAL_CA_CERT_BUNDLE' => bundle,
+ 'PIP_INDEX_URL' => index_url
+ })
expect(report).to match_schema(version: '2.0')
expect(report.dependency_names).to include('requests')