summaryrefslogtreecommitdiff
path: root/spec/integration
diff options
context:
space:
mode:
authorCan Eldem <celdem@gitlab.com>2020-10-06 10:37:53 +0000
committerCan Eldem <celdem@gitlab.com>2020-10-06 10:37:53 +0000
commit7fe70519010e24fa1d6735b108793987e8a24aa4 (patch)
treeaf3d60cd146203f4cc8d04f9a7883ef81f34f836 /spec/integration
parentae334f0af0155112c345475d9837de8538b58b7a (diff)
parentea3481fdb3bc94ce882f045d42ae9984548fc0e5 (diff)
Merge branch 'go-modules-subdir' into 'master'v3.26.1
Scan sub directories of Golang projects Closes gitlab-org/gitlab#255605 See merge request gitlab-org/security-products/license-management!222
Diffstat (limited to 'spec/integration')
-rw-r--r--spec/integration/go/modules_spec.rb48
-rw-r--r--spec/integration/python/pipenv_spec.rb12
2 files changed, 60 insertions, 0 deletions
diff --git a/spec/integration/go/modules_spec.rb b/spec/integration/go/modules_spec.rb
index 9b735fb..3c2daf1 100644
--- a/spec/integration/go/modules_spec.rb
+++ b/spec/integration/go/modules_spec.rb
@@ -138,4 +138,52 @@ RSpec.describe "modules" do
specify { expect(subject).to match_schema }
end
end
+
+ context "when scanning a go.mod file located in a sub directory" do
+ let(:env) { { 'LICENSE_FINDER_CLI_OPTS' => '--recursive' } }
+
+ before do
+ runner.mount(dir: fixture_file('go/1.15-subdir'))
+ end
+
+ it 'produces the proper report' do
+ expect(subject).to match_schema
+ expect(subject.dependency_names).to match_array([
+ "github.com/BurntSushi/toml",
+ "github.com/cpuguy83/go-md2man/v2",
+ "github.com/davecgh/go-spew",
+ "github.com/google/renameio",
+ "github.com/julienschmidt/httprouter",
+ "github.com/kisielk/gotool",
+ "github.com/kr/pretty",
+ "github.com/kr/pty",
+ "github.com/kr/text",
+ "github.com/pkg/errors",
+ "github.com/pmezard/go-difflib",
+ "github.com/rogpeppe/go-internal",
+ "github.com/russross/blackfriday/v2",
+ "github.com/shurcooL/sanitized_anchor_name",
+ "github.com/stretchr/objx",
+ "github.com/stretchr/testify",
+ "github.com/urfave/cli",
+ "go.uber.org/atomic",
+ "go.uber.org/multierr",
+ "go.uber.org/tools",
+ "go.uber.org/zap",
+ "golang.org/x/crypto",
+ "golang.org/x/lint",
+ "golang.org/x/mod",
+ "golang.org/x/net",
+ "golang.org/x/sync",
+ "golang.org/x/sys",
+ "golang.org/x/text",
+ "golang.org/x/tools",
+ "golang.org/x/xerrors",
+ "gopkg.in/check.v1",
+ "gopkg.in/errgo.v2",
+ "gopkg.in/yaml.v2",
+ "honnef.co/go/tools"
+ ])
+ end
+ end
end
diff --git a/spec/integration/python/pipenv_spec.rb b/spec/integration/python/pipenv_spec.rb
index b7847fd..f13bd31 100644
--- a/spec/integration/python/pipenv_spec.rb
+++ b/spec/integration/python/pipenv_spec.rb
@@ -239,4 +239,16 @@ RSpec.describe "pipenv" do
expect(subject.dependency_names).to match_array(%w[Django docutils pytz requests])
end
end
+
+ context "when scanning a Python 3.4 project" do
+ before do
+ runner.mount(dir: fixture_file('python/pipenv/python-3.4/'))
+ end
+
+ specify do
+ expect(subject).to match_schema
+ expect(subject.dependency_names).to match_array(%w[docutils])
+ expect(subject.licenses_for('docutils')).to match_array(['public domain, python, 2-clause bsd, gpl 3 (see copying.txt)'])
+ end
+ end
end