@@ -33,15 +33,46 @@ def _get_target_class():
3333 def _make_one (self , * args , ** kw ):
3434 return self ._get_target_class ()(* args , ** kw )
3535
36+ def test_ctor_wo_client_info (self ):
37+ from google .cloud ._http import ClientInfo
38+ from google .cloud .runtimeconfig ._http import Connection
39+
40+ PROJECT = "PROJECT"
41+ http = object ()
42+ creds = _make_credentials ()
43+
44+ client = self ._make_one (project = PROJECT , credentials = creds , _http = http )
45+ self .assertIsInstance (client ._connection , Connection )
46+ self .assertIs (client ._credentials , creds )
47+ self .assertIs (client ._http_internal , http )
48+ self .assertIsInstance (client ._connection ._client_info , ClientInfo )
49+
50+ def test_ctor_w_client_info (self ):
51+ from google .cloud ._http import ClientInfo
52+ from google .cloud .runtimeconfig ._http import Connection
53+
54+ PROJECT = "PROJECT"
55+ http = object ()
56+ creds = _make_credentials ()
57+ client_info = ClientInfo ()
58+
59+ client = self ._make_one (
60+ project = PROJECT , credentials = creds , _http = http , client_info = client_info
61+ )
62+ self .assertIsInstance (client ._connection , Connection )
63+ self .assertIs (client ._credentials , creds )
64+ self .assertIs (client ._http_internal , http )
65+ self .assertIs (client ._connection ._client_info , client_info )
66+
3667 def test_config (self ):
3768 PROJECT = "PROJECT"
3869 CONFIG_NAME = "config_name"
3970 creds = _make_credentials ()
4071
41- client_obj = self ._make_one (project = PROJECT , credentials = creds )
42- new_config = client_obj .config (CONFIG_NAME )
72+ client = self ._make_one (project = PROJECT , credentials = creds )
73+ new_config = client .config (CONFIG_NAME )
4374 self .assertEqual (new_config .name , CONFIG_NAME )
44- self .assertIs (new_config ._client , client_obj )
75+ self .assertIs (new_config ._client , client )
4576 self .assertEqual (new_config .project , PROJECT )
4677 self .assertEqual (
4778 new_config .full_name , "projects/%s/configs/%s" % (PROJECT , CONFIG_NAME )
0 commit comments