File: test_get_container_url.rb

package info (click to toggle)
ruby-gitlab-fog-azure-rm 1.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 756 kB
  • sloc: ruby: 5,926; sh: 9; makefile: 4
file content (30 lines) | stat: -rw-r--r-- 1,007 bytes parent folder | download | duplicates (2)
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
require File.expand_path '../../test_helper', __dir__

# Storage Container Class
class TestGetContainerUrl < Minitest::Test
  # This class posesses the test cases for the requests of getting storage container url.
  def setup
    Fog.mock!
    @mock_service = Fog::AzureRM::Storage.new(storage_account_credentials)
    Fog.unmock!

    @service = Fog::AzureRM::Storage.new(storage_account_credentials)

    @url = ApiStub::Requests::Storage::Directory.container_https_url
  end

  def test_get_container_url_success
    assert_equal @url, @service.get_container_url('test_container')

    options = { scheme: 'http' }
    assert_equal @url.gsub('https:', 'http:'), @service.get_container_url('test_container', options)
  end

  def test_get_container_url_mock
    assert_equal @url, @mock_service.get_container_url('test_container')

    options = { scheme: 'http' }
    http_url = @url.gsub('https:', 'http:')
    assert_equal http_url, @mock_service.get_container_url('test_container', options)
  end
end