require 'spec_helper'
require 'json'

# Unit tests for Phrase::UploadsApi
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe 'UploadsApi' do
  before do
    # run before each test
    @api_instance = Phrase::UploadsApi.new
  end

  after do
    # run after each test
  end

  describe 'test an instance of UploadsApi' do
    it 'should create an instance of UploadsApi' do
      expect(@api_instance).to be_instance_of(Phrase::UploadsApi)
    end
  end

  # unit tests for upload_create
  # Upload a new file
  # Upload a new language file. Creates necessary resources in your project.
  # @param project_id Project ID
  # @param [Hash] opts the optional parameters
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
  # @option opts [String] :branch specify the branch to use
  # @option opts [File] :file File to be imported
  # @option opts [String] :file_format File format. Auto-detected when possible and not specified.
  # @option opts [String] :locale_id Locale of the file's content. Can be the name or public id of the locale. Preferred is the public id.
  # @option opts [String] :tags List of tags separated by comma to be associated with the new keys contained in the upload.
  # @option opts [Boolean] :update_translations Indicates whether existing translations should be updated with the file content.
  # @option opts [Boolean] :update_descriptions Existing key descriptions will be updated with the file content. Empty descriptions overwrite existing descriptions.
  # @option opts [Boolean] :convert_emoji This option is obsolete. Providing the option will cause a bad request error.
  # @option opts [Boolean] :skip_upload_tags Indicates whether the upload should not create upload tags.
  # @option opts [Boolean] :skip_unverification Indicates whether the upload should unverify updated translations.
  # @option opts [String] :file_encoding Enforces a specific encoding on the file contents. Valid options are \\\"UTF-8\\\", \\\"UTF-16\\\" and \\\"ISO-8859-1\\\".
  # @option opts [Object] :locale_mapping Optional, format specific mapping between locale names and the columns the translations to those locales are contained in.
  # @option opts [Object] :format_options Additional options available for specific formats. See our format guide for complete list.
  # @option opts [Boolean] :autotranslate If set, translations for the uploaded language will be fetched automatically.
  # @option opts [Boolean] :mark_reviewed Indicated whether the imported translations should be marked as reviewed. This setting is available if the review workflow is enabled for the project.
  # @option opts [Boolean] :tag_only_affected_keys Indicates whether only keys affected (created or updated) by the upload should be tagged. The default is `false`
  # @return [Upload]
  describe 'upload_create test' do
    let(:response_body) { { data: {} }.to_json }
    before do
      stub_request(:any, /.*phrase.com/)
        .to_return(status: 200, body: response_body, headers: {
          'Content-Type' => 'application/json'
        })
    end

    it 'should work' do
      @api_instance.upload_create('project_id', file: File.new('Gemfile'))

      expect(a_request(:post, 'https://api.phrase.com/v2/projects/project_id/uploads')
        .with { |req|
          expect(req.headers['Content-Type']).to eq('multipart/form-data')
          # expect(req.body).to include('Gemfile')
        }).to have_been_made
    end
  end

  # unit tests for upload_show
  # Get a single upload
  # View details and summary for a single upload.
  # @param project_id Project ID
  # @param id ID
  # @param [Hash] opts the optional parameters
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
  # @option opts [String] :branch specify the branch to use
  # @return [Upload]
  describe 'upload_show test' do
    it 'should work' do
      # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
    end
  end

  # unit tests for uploads_list
  # List uploads
  # List all uploads for the given project.
  # @param project_id Project ID
  # @param [Hash] opts the optional parameters
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
  # @option opts [Integer] :page Page number
  # @option opts [Integer] :per_page Limit on the number of objects to be returned, between 1 and 100. 25 by default
  # @option opts [String] :branch specify the branch to use
  # @return [Array<Upload>]
  describe 'uploads_list test' do
    it 'should work' do
      # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
    end
  end

end