Welcome to mirror list, hosted at ThFree Co, Russian Federation.

get_importable_data_service_spec.rb « bulk_imports « services « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: eccd3e5f49d5afa5e4708a1c93bc52455081bcb2 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe BulkImports::GetImportableDataService do
  describe '#execute' do
    include_context 'bulk imports requests context', 'https://gitlab.example.com'

    let_it_be(:params) { { per_page: 20, page: 1 } }
    let_it_be(:query_params) { { top_level_only: true, min_access_level: 50, search: '' } }
    let_it_be(:credentials) { { url: 'https://gitlab.example.com', access_token: 'demo-pat' } }
    let_it_be(:expected_version_validation) do
      {
        features: {
          project_migration: {
            available: true,
            min_version: BulkImport.min_gl_version_for_project_migration.to_s
          },
          'source_instance_version': BulkImport.min_gl_version_for_project_migration.to_s
        }
      }
    end

    let_it_be(:expected_parsed_response) do
      [
        {
          'id' => 2595438,
          'web_url' => 'https://gitlab.com/groups/auto-breakfast',
          'name' => 'Stub',
          'path' => 'stub-group',
          'full_name' => 'Stub',
          'full_path' => 'stub-group'
        }
      ]
    end

    subject do
      described_class.new(params, query_params, credentials).execute
    end

    it 'returns version_validation and a response' do
      expect(subject[:version_validation]).to eq(expected_version_validation)
      expect(subject[:response].parsed_response).to eq(expected_parsed_response)
    end
  end
end