aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVadym Matsishevskyi <25311427+vam-google@users.noreply.github.com>2021-05-17 17:01:54 -0700
committerGitHub <noreply@github.com>2021-05-17 17:01:54 -0700
commit15aca6b288b2ec5ce0251e442e1dfa7f52e1b124 (patch)
treef003adab31b0566cdb345423d2e4195d4e3ceb6c /tests
parent03a79f118a6ec3c5d28a1a7de9798ab513f5b16a (diff)
downloadpython-api-core-15aca6b288b2ec5ce0251e442e1dfa7f52e1b124.tar.gz
feat: Add support for `rest/` token in `x-goog-api-client` header (#189)
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_client_info.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/unit/test_client_info.py b/tests/unit/test_client_info.py
index 0eb17c5..f2274ec 100644
--- a/tests/unit/test_client_info.py
+++ b/tests/unit/test_client_info.py
@@ -24,6 +24,7 @@ def test_constructor_defaults():
assert info.api_core_version is not None
assert info.gapic_version is None
assert info.client_library_version is None
+ assert info.rest_version is None
def test_constructor_options():
@@ -33,7 +34,8 @@ def test_constructor_options():
api_core_version="3",
gapic_version="4",
client_library_version="5",
- user_agent="6"
+ user_agent="6",
+ rest_version="7",
)
assert info.python_version == "1"
@@ -42,6 +44,7 @@ def test_constructor_options():
assert info.gapic_version == "4"
assert info.client_library_version == "5"
assert info.user_agent == "6"
+ assert info.rest_version == "7"
def test_to_user_agent_minimal():
@@ -67,3 +70,19 @@ def test_to_user_agent_full():
user_agent = info.to_user_agent()
assert user_agent == "app-name/1.0 gl-python/1 grpc/2 gax/3 gapic/4 gccl/5"
+
+
+def test_to_user_agent_rest():
+ info = client_info.ClientInfo(
+ python_version="1",
+ grpc_version=None,
+ rest_version="2",
+ api_core_version="3",
+ gapic_version="4",
+ client_library_version="5",
+ user_agent="app-name/1.0",
+ )
+
+ user_agent = info.to_user_agent()
+
+ assert user_agent == "app-name/1.0 gl-python/1 rest/2 gax/3 gapic/4 gccl/5"