Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
68b43f4d
Commit
68b43f4d
authored
Dec 04, 2017
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test usage of custom user agent in GCP Client
parent
04c6d102
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
lib/google_api/cloud_platform/client.rb
lib/google_api/cloud_platform/client.rb
+3
-3
spec/lib/google_api/cloud_platform/client_spec.rb
spec/lib/google_api/cloud_platform/client_spec.rb
+7
-3
No files found.
lib/google_api/cloud_platform/client.rb
View file @
68b43f4d
...
@@ -44,7 +44,7 @@ module GoogleApi
...
@@ -44,7 +44,7 @@ module GoogleApi
service
=
Google
::
Apis
::
ContainerV1
::
ContainerService
.
new
service
=
Google
::
Apis
::
ContainerV1
::
ContainerService
.
new
service
.
authorization
=
access_token
service
.
authorization
=
access_token
service
.
get_zone_cluster
(
project_id
,
zone
,
cluster_id
)
service
.
get_zone_cluster
(
project_id
,
zone
,
cluster_id
,
options:
user_agent_header
)
end
end
def
projects_zones_clusters_create
(
project_id
,
zone
,
cluster_name
,
cluster_size
,
machine_type
:)
def
projects_zones_clusters_create
(
project_id
,
zone
,
cluster_name
,
cluster_size
,
machine_type
:)
...
@@ -62,14 +62,14 @@ module GoogleApi
...
@@ -62,14 +62,14 @@ module GoogleApi
}
}
}
)
}
)
service
.
create_cluster
(
project_id
,
zone
,
request_body
)
service
.
create_cluster
(
project_id
,
zone
,
request_body
,
options:
user_agent_header
)
end
end
def
projects_zones_operations
(
project_id
,
zone
,
operation_id
)
def
projects_zones_operations
(
project_id
,
zone
,
operation_id
)
service
=
Google
::
Apis
::
ContainerV1
::
ContainerService
.
new
service
=
Google
::
Apis
::
ContainerV1
::
ContainerService
.
new
service
.
authorization
=
access_token
service
.
authorization
=
access_token
service
.
get_zone_operation
(
project_id
,
zone
,
operation_id
)
service
.
get_zone_operation
(
project_id
,
zone
,
operation_id
,
options:
user_agent_header
)
end
end
def
parse_operation_id
(
self_link
)
def
parse_operation_id
(
self_link
)
...
...
spec/lib/google_api/cloud_platform/client_spec.rb
View file @
68b43f4d
...
@@ -3,6 +3,7 @@ require 'spec_helper'
...
@@ -3,6 +3,7 @@ require 'spec_helper'
describe
GoogleApi
::
CloudPlatform
::
Client
do
describe
GoogleApi
::
CloudPlatform
::
Client
do
let
(
:token
)
{
'token'
}
let
(
:token
)
{
'token'
}
let
(
:client
)
{
described_class
.
new
(
token
,
nil
)
}
let
(
:client
)
{
described_class
.
new
(
token
,
nil
)
}
let
(
:user_agent_options
)
{
client
.
instance_eval
{
user_agent_header
}
}
describe
'.session_key_for_redirect_uri'
do
describe
'.session_key_for_redirect_uri'
do
let
(
:state
)
{
'random_string'
}
let
(
:state
)
{
'random_string'
}
...
@@ -55,7 +56,8 @@ describe GoogleApi::CloudPlatform::Client do
...
@@ -55,7 +56,8 @@ describe GoogleApi::CloudPlatform::Client do
before
do
before
do
allow_any_instance_of
(
Google
::
Apis
::
ContainerV1
::
ContainerService
)
allow_any_instance_of
(
Google
::
Apis
::
ContainerV1
::
ContainerService
)
.
to
receive
(
:get_zone_cluster
).
and_return
(
gke_cluster
)
.
to
receive
(
:get_zone_cluster
).
with
(
any_args
,
options:
user_agent_options
)
.
and_return
(
gke_cluster
)
end
end
it
{
is_expected
.
to
eq
(
gke_cluster
)
}
it
{
is_expected
.
to
eq
(
gke_cluster
)
}
...
@@ -74,7 +76,8 @@ describe GoogleApi::CloudPlatform::Client do
...
@@ -74,7 +76,8 @@ describe GoogleApi::CloudPlatform::Client do
before
do
before
do
allow_any_instance_of
(
Google
::
Apis
::
ContainerV1
::
ContainerService
)
allow_any_instance_of
(
Google
::
Apis
::
ContainerV1
::
ContainerService
)
.
to
receive
(
:create_cluster
).
and_return
(
operation
)
.
to
receive
(
:create_cluster
).
with
(
any_args
,
options:
user_agent_options
)
.
and_return
(
operation
)
end
end
it
{
is_expected
.
to
eq
(
operation
)
}
it
{
is_expected
.
to
eq
(
operation
)
}
...
@@ -102,7 +105,8 @@ describe GoogleApi::CloudPlatform::Client do
...
@@ -102,7 +105,8 @@ describe GoogleApi::CloudPlatform::Client do
before
do
before
do
allow_any_instance_of
(
Google
::
Apis
::
ContainerV1
::
ContainerService
)
allow_any_instance_of
(
Google
::
Apis
::
ContainerV1
::
ContainerService
)
.
to
receive
(
:get_zone_operation
).
and_return
(
operation
)
.
to
receive
(
:get_zone_operation
).
with
(
any_args
,
options:
user_agent_options
)
.
and_return
(
operation
)
end
end
it
{
is_expected
.
to
eq
(
operation
)
}
it
{
is_expected
.
to
eq
(
operation
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment