@@ -33,7 +33,7 @@ def _make_one(self, *args, **kw):
3333
3434 def _verifyResourceProperties (self , variable , resource ):
3535 import base64
36- from google .cloud . _helpers import _rfc3339_to_datetime
36+ from google .api_core import datetime_helpers
3737
3838 if 'name' in resource :
3939 self .assertEqual (variable .full_name , resource ['name' ])
@@ -50,7 +50,8 @@ def _verifyResourceProperties(self, variable, resource):
5050 if 'updateTime' in resource :
5151 self .assertEqual (
5252 variable .update_time ,
53- _rfc3339_to_datetime (resource ['updateTime' ]))
53+ datetime_helpers .DatetimeWithNanoseconds .from_rfc3339 (
54+ resource ['updateTime' ]))
5455 else :
5556 self .assertIsNone (variable .update_time )
5657
@@ -178,6 +179,32 @@ def test_reload_w_alternate_client(self):
178179 self .assertEqual (req ['path' ], '/%s' % (self .PATH ,))
179180 self ._verifyResourceProperties (variable , RESOURCE )
180181
182+ def test_with_microseconds (self ):
183+ from google .cloud .runtimeconfig .config import Config
184+
185+ resource = {
186+ 'updateTime' : '2016-04-14T21:21:54.123456Z' ,
187+ }
188+ conn = _Connection (resource )
189+ client = _Client (project = self .PROJECT , connection = conn )
190+ config = Config (name = self .CONFIG_NAME , client = client )
191+ variable = self ._make_one (name = self .VARIABLE_NAME , config = config )
192+ variable .reload (client = client )
193+ self ._verifyResourceProperties (variable , resource )
194+
195+ def test_with_nanoseconds (self ):
196+ from google .cloud .runtimeconfig .config import Config
197+
198+ resource = {
199+ 'updateTime' : '2016-04-14T21:21:54.123456789Z' ,
200+ }
201+ conn = _Connection (resource )
202+ client = _Client (project = self .PROJECT , connection = conn )
203+ config = Config (name = self .CONFIG_NAME , client = client )
204+ variable = self ._make_one (name = self .VARIABLE_NAME , config = config )
205+ variable .reload (client = client )
206+ self ._verifyResourceProperties (variable , resource )
207+
181208
182209class _Client (object ):
183210
0 commit comments