diff options
| author | mo khan <mo.khan@gmail.com> | 2020-08-04 14:51:49 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-08-07 12:44:29 -0600 |
| commit | ca3e93e2f67707a016b28e58f8374522a1fb68f0 (patch) | |
| tree | 63f5341b5b2ef4732cd0ec3717f9bb01378eb507 /spec/integration | |
| parent | 71e548e24191f9afe53f5679906d464b24c5c985 (diff) | |
Add limited network support for Cargo projects
* Add test to scan cargo project with packages from a private registry
* Synchronize mono cert store
* Wipe nuget package cache before specs
* Compress /usr/local/share
* Exclude development dependencies
* Add CHANGELOG entry
Diffstat (limited to 'spec/integration')
| -rw-r--r-- | spec/integration/rust/cargo_spec.rb | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/spec/integration/rust/cargo_spec.rb b/spec/integration/rust/cargo_spec.rb new file mode 100644 index 0000000..77ad447 --- /dev/null +++ b/spec/integration/rust/cargo_spec.rb @@ -0,0 +1,58 @@ +require 'spec_helper' + +RSpec.describe "cargo" do + subject { runner.scan(env: env) } + + let(:env) { {} } + + context "when scanning a cargo project" do + before do + runner.mount(dir: fixture_file('rust/cargo/hello_world')) + end + + specify { expect(subject).to match_schema } + + specify do + expect(subject.dependency_names).to match_array(%w[libc time]) + end + + specify { expect(subject.licenses_for('libc')).to match_array(['mit or apache-2.0']) } + specify { expect(subject.licenses_for('time')).to match_array(['Apache-2.0', 'MIT']) } + end + + context "when fetching dependencies from a custom registry" do + before do + add_host('cargo.test', '127.0.0.1') + start_proxy_server + runner.mount(dir: fixture_file('rust/cargo/custom-tls')) + end + + context "when the CA certificate is provided" do + let(:env) { { 'ADDITIONAL_CA_CERT_BUNDLE' => x509_certificate('wildcard.test').read } } + + specify do + expect(subject).to match_schema + expect(subject.dependency_names).to match_array(['libc']) + expect(subject.licenses_for('libc')).to match_array(['mit or apache-2.0']) + end + end + + context "when the CA certificate is NOT provided" do + let(:env) { {} } + + specify { expect(subject).to match_schema } + end + end + + context "when scanning a project with dev dependencies" do + before do + runner.mount(dir: fixture_file('rust/cargo/dev-dependencies')) + end + + it 'excludes them from the report' do + expect(subject).to match_schema + expect(subject.dependency_names).to include('diesel') + expect(subject.dependency_names).not_to include('pretty_assertions') + end + end +end |
