gitlab-fog-azure-rm 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/gitlab-fog-azure-rm.gemspec +0 -1
- data/lib/fog/azurerm/constants.rb +0 -6
- data/lib/fog/azurerm/custom_fog_errors.rb +0 -41
- data/lib/fog/azurerm/storage.rb +0 -18
- data/lib/fog/azurerm/utilities/general.rb +2 -53
- data/lib/fog/azurerm/version.rb +1 -1
- data/lib/fog/azurerm.rb +0 -6
- data/test/test_helper.rb +0 -8
- metadata +3 -19
- data/lib/fog/azurerm/credentials.rb +0 -44
- data/test/test_credentials.rb +0 -63
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e159dfc8b3cace029e335019a550572fd139b03621711088ef223f87989b0b97
|
4
|
+
data.tar.gz: aaebbcfd822283723b45ebb2db3a1588a67ca90b26cd1ddc319630f21131338d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28dd5cd1ed31cad829892047887b48790f78370fa2b2e56fd5f5aa57140347cb7f31db8fc03d37552ffdfe0bcda6a6a219541b713d9b286c7d0a833934785ebe
|
7
|
+
data.tar.gz: 7604dd353e7d0345943e4d90bdc77184ca293deb605d1d3682a293107ae55c38026cde9e88f5ddee3c60c709046dd742a5d08864b8b601fa7609a33d8c807e55
|
data/CHANGELOG.md
CHANGED
data/gitlab-fog-azure-rm.gemspec
CHANGED
@@ -34,12 +34,6 @@ module Fog
|
|
34
34
|
ENVIRONMENT_AZURE_US_GOVERNMENT = 'AzureUSGovernment'.freeze
|
35
35
|
ENVIRONMENT_AZURE_GERMAN_CLOUD = 'AzureGermanCloud'.freeze
|
36
36
|
|
37
|
-
# MsRestAzure::AzureOperationError class Error Codes
|
38
|
-
ERROR_CODE_RESOURCE_NOT_FOUND = 'ResourceNotFound'.freeze
|
39
|
-
ERROR_CODE_NOT_FOUND = 'NotFound'.freeze
|
40
|
-
ERROR_CODE_RESOURCE_GROUP_NOT_FOUND = 'ResourceGroupNotFound'.freeze
|
41
|
-
ERROR_CODE_PARENT_RESOURCE_NOT_FOUND = 'ParentResourceNotFound'.freeze
|
42
|
-
|
43
37
|
PLATFORM_LINUX = 'linux'.freeze
|
44
38
|
|
45
39
|
# State of the copy operation
|
@@ -1,47 +1,6 @@
|
|
1
1
|
# This file contains any or all custom Fog errors that we create
|
2
2
|
module Fog
|
3
3
|
module AzureRM
|
4
|
-
# This is a custom Fog exception inherited from MsRestAzure::AzureOperationError
|
5
|
-
class CustomAzureOperationError < MsRestAzure::AzureOperationError
|
6
|
-
def initialize(message, azure_exception)
|
7
|
-
super(azure_exception.request, azure_exception.response, azure_exception.body, "Exception in #{message}")
|
8
|
-
end
|
9
|
-
|
10
|
-
def print_subscription_limits_information
|
11
|
-
request_method = @request.method
|
12
|
-
subscription_id = @request.path_params['subscriptionId']
|
13
|
-
|
14
|
-
limit_value = remaining_subscription_request_limits(@response)
|
15
|
-
|
16
|
-
puts "Subscription: '#{subscription_id}'. Request Method: '#{request_method}'. \nLimit Value: #{limit_value['header']}: #{limit_value['value']}\n" unless limit_value.empty?
|
17
|
-
end
|
18
|
-
|
19
|
-
def remaining_subscription_request_limits(response)
|
20
|
-
limit = {}
|
21
|
-
# handles both read and write limits
|
22
|
-
if response.headers.key? 'x-ms-ratelimit-remaining-subscription-resource-requests'
|
23
|
-
limit['header'] = 'x-ms-ratelimit-remaining-subscription-resource-requests'
|
24
|
-
limit['value'] = response.headers['x-ms-ratelimit-remaining-subscription-resource-requests']
|
25
|
-
|
26
|
-
# limit for collection API calls
|
27
|
-
elsif response.headers.key? 'x-ms-ratelimit-remaining-subscription-resource-entities-read'
|
28
|
-
limit['header'] = 'x-ms-ratelimit-remaining-subscription-resource-entities-read'
|
29
|
-
limit['value'] = response.headers['x-ms-ratelimit-remaining-subscription-resource-entities-read']
|
30
|
-
|
31
|
-
# read requests limit
|
32
|
-
elsif response.headers.key? 'x-ms-ratelimit-remaining-subscription-reads'
|
33
|
-
limit['header'] = 'x-ms-ratelimit-remaining-subscription-reads'
|
34
|
-
limit['value'] = response.headers['x-ms-ratelimit-remaining-subscription-reads']
|
35
|
-
|
36
|
-
# write requests limit
|
37
|
-
elsif response.headers.key? 'x-ms-ratelimit-remaining-subscription-writes'
|
38
|
-
limit['header'] = 'x-ms-ratelimit-remaining-subscription-writes'
|
39
|
-
limit['value'] = response.headers['x-ms-ratelimit-remaining-subscription-writes']
|
40
|
-
end
|
41
|
-
limit
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
4
|
# This is a custom Fog exception inherited from Azure::Core::Http::HTTPError
|
46
5
|
class CustomAzureCoreHttpError < Azure::Core::Http::HTTPError
|
47
6
|
def initialize(azure_exception)
|
data/lib/fog/azurerm/storage.rb
CHANGED
@@ -2,13 +2,6 @@ module Fog
|
|
2
2
|
module Storage
|
3
3
|
# This class registers models, requests and collections
|
4
4
|
class AzureRM < Fog::Service
|
5
|
-
# Recognizes when creating management client
|
6
|
-
recognizes :tenant_id
|
7
|
-
recognizes :client_id
|
8
|
-
recognizes :client_secret
|
9
|
-
recognizes :subscription_id
|
10
|
-
recognizes :environment
|
11
|
-
|
12
5
|
# Recognizes when creating data client
|
13
6
|
recognizes :azure_storage_account_name
|
14
7
|
recognizes :azure_storage_access_key
|
@@ -95,17 +88,6 @@ module Fog
|
|
95
88
|
raise e.message
|
96
89
|
end
|
97
90
|
|
98
|
-
options[:environment] = 'AzureCloud' if options[:environment].nil?
|
99
|
-
|
100
|
-
@tenant_id = options[:tenant_id]
|
101
|
-
@client_id = options[:client_id]
|
102
|
-
@client_secret = options[:client_secret]
|
103
|
-
@subscription_id = options[:subscription_id]
|
104
|
-
@environment = options[:environment]
|
105
|
-
|
106
|
-
credentials = Fog::Credentials::AzureRM.get_credentials(@tenant_id, @client_id, @client_secret, @environment)
|
107
|
-
telemetry = "gitlab-fog-azure-rm/#{Fog::AzureRM::VERSION}"
|
108
|
-
|
109
91
|
return unless @azure_storage_account_name != options[:azure_storage_account_name] ||
|
110
92
|
@azure_storage_access_key != options[:azure_storage_access_key]
|
111
93
|
|
@@ -53,13 +53,9 @@ module Fog
|
|
53
53
|
type.split('/').last
|
54
54
|
end
|
55
55
|
|
56
|
-
def raise_azure_exception(exception,
|
56
|
+
def raise_azure_exception(exception, _msg)
|
57
57
|
raise Fog::AzureRM::CustomAzureCoreHttpError.new(exception) if exception.is_a?(Azure::Core::Http::HTTPError)
|
58
|
-
raise exception
|
59
|
-
|
60
|
-
azure_operation_error = Fog::AzureRM::CustomAzureOperationError.new(msg, exception)
|
61
|
-
azure_operation_error.print_subscription_limits_information if !azure_operation_error.request.nil? && !azure_operation_error.response.nil?
|
62
|
-
raise azure_operation_error
|
58
|
+
raise exception
|
63
59
|
end
|
64
60
|
|
65
61
|
# Make sure if input_params(Hash) contains all keys present in required_params(Array)
|
@@ -80,47 +76,15 @@ module Fog
|
|
80
76
|
(0...length).map { ('a'..'z').to_a[rand(26)] }.join
|
81
77
|
end
|
82
78
|
|
83
|
-
def active_directory_service_settings(environment = ENVIRONMENT_AZURE_CLOUD)
|
84
|
-
case environment
|
85
|
-
when ENVIRONMENT_AZURE_CHINA_CLOUD
|
86
|
-
MsRestAzure::ActiveDirectoryServiceSettings.get_azure_china_settings
|
87
|
-
when ENVIRONMENT_AZURE_US_GOVERNMENT
|
88
|
-
MsRestAzure::ActiveDirectoryServiceSettings.get_azure_us_government_settings
|
89
|
-
when ENVIRONMENT_AZURE_GERMAN_CLOUD
|
90
|
-
MsRestAzure::ActiveDirectoryServiceSettings.get_azure_german_settings
|
91
|
-
else
|
92
|
-
MsRestAzure::ActiveDirectoryServiceSettings.get_azure_settings
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def resource_manager_endpoint_url(environment = ENVIRONMENT_AZURE_CLOUD)
|
97
|
-
case environment
|
98
|
-
when ENVIRONMENT_AZURE_CHINA_CLOUD
|
99
|
-
MsRestAzure::AzureEnvironments::ChinaCloud.resource_manager_endpoint_url
|
100
|
-
when ENVIRONMENT_AZURE_US_GOVERNMENT
|
101
|
-
MsRestAzure::AzureEnvironments::USGovernment.resource_manager_endpoint_url
|
102
|
-
when ENVIRONMENT_AZURE_GERMAN_CLOUD
|
103
|
-
MsRestAzure::AzureEnvironments::GermanCloud.resource_manager_endpoint_url
|
104
|
-
else
|
105
|
-
MsRestAzure::AzureEnvironments::AzureCloud.resource_manager_endpoint_url
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
# storage_endpoint_suffix is nil in ms_rest_azure 0.6.2
|
110
|
-
# Reference the issue: https://github.com/Azure/azure-sdk-for-ruby/issues/603
|
111
79
|
def storage_endpoint_suffix(environment = ENVIRONMENT_AZURE_CLOUD)
|
112
80
|
case environment
|
113
81
|
when ENVIRONMENT_AZURE_CHINA_CLOUD
|
114
|
-
# MsRestAzure::AzureEnvironments::AzureChina.storage_endpoint_suffix
|
115
82
|
'.core.chinacloudapi.cn'
|
116
83
|
when ENVIRONMENT_AZURE_US_GOVERNMENT
|
117
|
-
# MsRestAzure::AzureEnvironments::AzureUSGovernment.storage_endpoint_suffix
|
118
84
|
'.core.usgovcloudapi.net'
|
119
85
|
when ENVIRONMENT_AZURE_GERMAN_CLOUD
|
120
|
-
# MsRestAzure::AzureEnvironments::AzureGermanCloud.storage_endpoint_suffix
|
121
86
|
'.core.cloudapi.de'
|
122
87
|
else
|
123
|
-
# MsRestAzure::AzureEnvironments::Azure.storage_endpoint_suffix
|
124
88
|
'.core.windows.net'
|
125
89
|
end
|
126
90
|
end
|
@@ -172,21 +136,6 @@ module Fog
|
|
172
136
|
data
|
173
137
|
end
|
174
138
|
|
175
|
-
def resource_not_found?(azure_operation_error)
|
176
|
-
is_found = false
|
177
|
-
if azure_operation_error.response.status == HTTP_NOT_FOUND
|
178
|
-
if azure_operation_error.body['code']
|
179
|
-
is_found = azure_operation_error.body['code'] == ERROR_CODE_NOT_FOUND
|
180
|
-
elsif azure_operation_error.body['error']
|
181
|
-
is_found = azure_operation_error.body['error']['code'] == ERROR_CODE_NOT_FOUND ||
|
182
|
-
azure_operation_error.body['error']['code'] == ERROR_CODE_RESOURCE_GROUP_NOT_FOUND ||
|
183
|
-
azure_operation_error.body['error']['code'] == ERROR_CODE_RESOURCE_NOT_FOUND ||
|
184
|
-
azure_operation_error.body['error']['code'] == ERROR_CODE_PARENT_RESOURCE_NOT_FOUND
|
185
|
-
end
|
186
|
-
end
|
187
|
-
is_found
|
188
|
-
end
|
189
|
-
|
190
139
|
def get_image_name(id)
|
191
140
|
id.split('/').last
|
192
141
|
end
|
data/lib/fog/azurerm/version.rb
CHANGED
data/lib/fog/azurerm.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'ms_rest_azure'
|
2
1
|
require 'azure/core/http/http_error'
|
3
2
|
require 'erb'
|
4
3
|
require 'fog/azurerm/config'
|
@@ -12,11 +11,6 @@ require 'fog/azurerm/models/storage/sku_tier'
|
|
12
11
|
require 'fog/azurerm/models/storage/kind'
|
13
12
|
|
14
13
|
module Fog
|
15
|
-
# Autoload Module for Credentials
|
16
|
-
module Credentials
|
17
|
-
autoload :AzureRM, File.expand_path('azurerm/credentials', __dir__)
|
18
|
-
end
|
19
|
-
|
20
14
|
# Autoload Module for Storage
|
21
15
|
module Storage
|
22
16
|
autoload :AzureRM, File.expand_path('azurerm/storage', __dir__)
|
data/test/test_helper.rb
CHANGED
@@ -20,14 +20,6 @@ require 'azure/core/http/http_response'
|
|
20
20
|
$LOAD_PATH.unshift(File.expand_path '../lib', __dir__)
|
21
21
|
require File.expand_path '../lib/fog/azurerm', __dir__
|
22
22
|
require File.expand_path './api_stub', __dir__
|
23
|
-
def credentials
|
24
|
-
{
|
25
|
-
tenant_id: '<TENANT-ID>',
|
26
|
-
client_id: '<CLIENT-ID>',
|
27
|
-
client_secret: '<CLIENT-SECRET>',
|
28
|
-
subscription_id: '<SUBSCRIPTION-ID>'
|
29
|
-
}
|
30
|
-
end
|
31
23
|
|
32
24
|
def storage_account_credentials
|
33
25
|
{
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-fog-azure-rm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shaffan Chaudhry
|
@@ -18,7 +18,7 @@ authors:
|
|
18
18
|
autorequire:
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
|
-
date: 2023-
|
21
|
+
date: 2023-07-12 00:00:00.000000000 Z
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
24
|
name: codeclimate-test-reporter
|
@@ -160,20 +160,6 @@ dependencies:
|
|
160
160
|
- - ">="
|
161
161
|
- !ruby/object:Gem::Version
|
162
162
|
version: '0'
|
163
|
-
- !ruby/object:Gem::Dependency
|
164
|
-
name: ms_rest_azure
|
165
|
-
requirement: !ruby/object:Gem::Requirement
|
166
|
-
requirements:
|
167
|
-
- - "~>"
|
168
|
-
- !ruby/object:Gem::Version
|
169
|
-
version: 0.12.0
|
170
|
-
type: :runtime
|
171
|
-
prerelease: false
|
172
|
-
version_requirements: !ruby/object:Gem::Requirement
|
173
|
-
requirements:
|
174
|
-
- - "~>"
|
175
|
-
- !ruby/object:Gem::Version
|
176
|
-
version: 0.12.0
|
177
163
|
description: This is a stripped-down fork of fog-azure-rm that enables Azure Blob
|
178
164
|
Storage to be used with CarrierWave and Fog.
|
179
165
|
email:
|
@@ -201,7 +187,6 @@ files:
|
|
201
187
|
- lib/fog/azurerm/async_response.rb
|
202
188
|
- lib/fog/azurerm/config.rb
|
203
189
|
- lib/fog/azurerm/constants.rb
|
204
|
-
- lib/fog/azurerm/credentials.rb
|
205
190
|
- lib/fog/azurerm/custom_fog_errors.rb
|
206
191
|
- lib/fog/azurerm/docs/storage.md
|
207
192
|
- lib/fog/azurerm/docs/structure.md
|
@@ -320,7 +305,6 @@ files:
|
|
320
305
|
- test/requests/storage/test_save_page_blob.rb
|
321
306
|
- test/requests/storage/test_wait_blob_copy_operation_to_finish.rb
|
322
307
|
- test/smoke_tests/compute/test_resource_group_smoke.rb
|
323
|
-
- test/test_credentials.rb
|
324
308
|
- test/test_helper.rb
|
325
309
|
homepage: https://gitlab.com/gitlab-org/gitlab-fog-azure-rm
|
326
310
|
licenses:
|
@@ -342,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
342
326
|
- !ruby/object:Gem::Version
|
343
327
|
version: '0'
|
344
328
|
requirements: []
|
345
|
-
rubygems_version: 3.4.
|
329
|
+
rubygems_version: 3.4.15
|
346
330
|
signing_key:
|
347
331
|
specification_version: 4
|
348
332
|
summary: Module for the 'fog' gem to support Azure Blob Storage with CarrierWave and
|
@@ -1,44 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Credentials
|
3
|
-
# This class is managing credentials token
|
4
|
-
class AzureRM
|
5
|
-
class << self
|
6
|
-
include Fog::AzureRM::Utilities::General
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.get_credentials(tenant_id, client_id, client_secret, environment = Fog::AzureRM::ENVIRONMENT_AZURE_CLOUD)
|
10
|
-
if @credentials.nil? || new_management_credential?(tenant_id, client_id, client_secret, environment)
|
11
|
-
get_new_credentials(tenant_id, client_id, client_secret, environment)
|
12
|
-
else
|
13
|
-
@credentials
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.get_token(tenant_id, client_id, client_secret, environment = Fog::AzureRM::ENVIRONMENT_AZURE_CLOUD)
|
18
|
-
get_credentials(tenant_id, client_id, client_secret, environment) if @credentials.nil?
|
19
|
-
@token_provider.get_authentication_header
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.get_new_credentials(tenant_id, client_id, client_secret, environment)
|
23
|
-
@tenant_id = tenant_id
|
24
|
-
@client_id = client_id
|
25
|
-
@client_secret = client_secret
|
26
|
-
@environment = environment
|
27
|
-
return if @tenant_id.nil? || @client_id.nil? || @client_secret.nil?
|
28
|
-
@token_provider = MsRestAzure::ApplicationTokenProvider.new(@tenant_id, @client_id, @client_secret, active_directory_service_settings(environment))
|
29
|
-
@credentials = MsRest::TokenCredentials.new(@token_provider)
|
30
|
-
@credentials
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.new_management_credential?(tenant_id, client_id, client_secret, environment)
|
34
|
-
@tenant_id != tenant_id ||
|
35
|
-
@client_id != client_id ||
|
36
|
-
@client_secret != client_secret ||
|
37
|
-
@environment != environment
|
38
|
-
end
|
39
|
-
|
40
|
-
private_class_method :get_new_credentials
|
41
|
-
private_class_method :new_management_credential?
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
data/test/test_credentials.rb
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
require File.expand_path 'test_helper', __dir__
|
2
|
-
|
3
|
-
# Test class for Credentials Helper Class
|
4
|
-
class TestCredentials < Minitest::Test
|
5
|
-
def setup
|
6
|
-
@creds = credentials
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_methods
|
10
|
-
methods = [
|
11
|
-
:get_credentials,
|
12
|
-
:get_token
|
13
|
-
]
|
14
|
-
methods.each do |method|
|
15
|
-
assert Fog::Credentials::AzureRM.respond_to? method
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_get_credentials_method_with_same_client
|
20
|
-
cred_obj_one = Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret])
|
21
|
-
cred_obj_two = Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret])
|
22
|
-
assert_equal cred_obj_one.object_id, cred_obj_two.object_id
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_get_credentials_method_with_different_client
|
26
|
-
cred_obj_one = Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret])
|
27
|
-
@creds[:client_id] = '<NEW-CLIENT-ID>'
|
28
|
-
cred_obj_two = Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret])
|
29
|
-
refute_equal cred_obj_one.object_id, cred_obj_two.object_id
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_get_token_method_with_default_environment
|
33
|
-
Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret])
|
34
|
-
token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
|
35
|
-
token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
36
|
-
assert_equal Fog::Credentials::AzureRM.get_token(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret]), 'Bearer <some-token>'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_get_token_method_with_china_environment
|
41
|
-
Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret], Fog::AzureRM::ENVIRONMENT_AZURE_CHINA_CLOUD)
|
42
|
-
token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
|
43
|
-
token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
44
|
-
assert_equal Fog::Credentials::AzureRM.get_token(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret]), 'Bearer <some-token>'
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_get_token_method_with_us_government_environment
|
49
|
-
Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret], Fog::AzureRM::ENVIRONMENT_AZURE_US_GOVERNMENT)
|
50
|
-
token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
|
51
|
-
token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
52
|
-
assert_equal Fog::Credentials::AzureRM.get_token(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret]), 'Bearer <some-token>'
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_get_token_method_with_german_environment
|
57
|
-
Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret], Fog::AzureRM::ENVIRONMENT_AZURE_GERMAN_CLOUD)
|
58
|
-
token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
|
59
|
-
token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
|
60
|
-
assert_equal Fog::Credentials::AzureRM.get_token(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret]), 'Bearer <some-token>'
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|