debian-mirror-gitlab/spec/finders/packages/pypi/package_finder_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
991 B
Ruby
Raw Normal View History

2021-06-08 01:23:25 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Packages::Pypi::PackageFinder do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, group: group) }
let_it_be(:project2) { create(:project, group: group) }
let_it_be(:package1) { create(:pypi_package, project: project) }
let_it_be(:package2) { create(:pypi_package, project: project) }
let_it_be(:package3) { create(:pypi_package, project: project2) }
let(:package_file) { package2.package_files.first }
let(:params) do
{
filename: package_file.file_name,
sha256: package_file.file_sha256
}
end
describe 'execute' do
subject { described_class.new(user, scope, params).execute }
context 'within a project' do
let(:scope) { project }
it { is_expected.to eq(package2) }
end
context 'within a group' do
let(:scope) { group }
2021-09-04 01:27:46 +05:30
it { is_expected.to eq(package2) }
2021-06-08 01:23:25 +05:30
end
end
end