summaryrefslogtreecommitdiff
path: root/spec/requests/api/debian_project_packages_spec.rb
blob: 4941f2a77f40637e62da3b6bca492cd93c43c949 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# frozen_string_literal: true
require 'spec_helper'

RSpec.describe API::DebianProjectPackages do
  include HttpBasicAuthHelpers
  include WorkhorseHelpers

  include_context 'Debian repository shared context', :project do
    describe 'GET projects/:id/packages/debian/dists/*distribution/Release.gpg' do
      let(:url) { "/projects/#{project.id}/packages/debian/dists/#{distribution}/Release.gpg" }

      it_behaves_like 'Debian project repository GET endpoint', :not_found, nil
    end

    describe 'GET projects/:id/packages/debian/dists/*distribution/Release' do
      let(:url) { "/projects/#{project.id}/packages/debian/dists/#{distribution}/Release" }

      it_behaves_like 'Debian project repository GET endpoint', :success, 'TODO Release'
    end

    describe 'GET projects/:id/packages/debian/dists/*distribution/InRelease' do
      let(:url) { "/projects/#{project.id}/packages/debian/dists/#{distribution}/InRelease" }

      it_behaves_like 'Debian project repository GET endpoint', :not_found, nil
    end

    describe 'GET projects/:id/packages/debian/dists/*distribution/:component/binary-:architecture/Packages' do
      let(:url) { "/projects/#{project.id}/packages/debian/dists/#{distribution}/#{component}/binary-#{architecture}/Packages" }

      it_behaves_like 'Debian project repository GET endpoint', :success, 'TODO Packages'
    end

    describe 'GET projects/:id/packages/debian/pool/:component/:letter/:source_package/:file_name' do
      let(:url) { "/projects/#{project.id}/packages/debian/pool/#{component}/#{letter}/#{source_package}/#{package_name}_#{package_version}_#{architecture}.deb" }

      it_behaves_like 'Debian project repository GET endpoint', :success, 'TODO File'
    end

    describe 'PUT projects/:id/packages/debian/:file_name' do
      let(:method) { :put }
      let(:url) { "/projects/#{project.id}/packages/debian/#{file_name}" }

      it_behaves_like 'Debian project repository PUT endpoint', :created, nil
    end

    describe 'PUT projects/:id/packages/debian/:file_name/authorize' do
      let(:method) { :put }
      let(:url) { "/projects/#{project.id}/packages/debian/#{file_name}/authorize" }

      it_behaves_like 'Debian project repository PUT endpoint', :created, nil, is_authorize: true
    end
  end
end