@@ -254,6 +254,26 @@ def mock_get_path():
254254
255255 self .assertEqual (result , project_id )
256256
257+ def test_nix_missing_prject_key (self ):
258+ from google .cloud import _helpers as MUT
259+ from google .cloud ._testing import _Monkey
260+ from google .cloud ._testing import _NamedTemporaryFile
261+
262+ with _NamedTemporaryFile () as temp :
263+ config_value = '[%s]' % (MUT ._GCLOUD_CONFIG_SECTION ,)
264+ with open (temp .name , 'w' ) as config_file :
265+ config_file .write (config_value )
266+
267+ def mock_get_path ():
268+ return temp .name
269+
270+ with _Monkey (os , name = 'not-nt' ):
271+ with _Monkey (MUT , _get_nix_config_path = mock_get_path ,
272+ _USER_ROOT = 'not-None' ):
273+ result = self ._callFUT ()
274+
275+ self .assertEqual (result , None )
276+
257277 def test_windows (self ):
258278 from google .cloud import _helpers as MUT
259279 from google .cloud ._testing import _Monkey
@@ -694,7 +714,6 @@ def test_w_utc_datetime(self):
694714
695715 def test_w_non_utc_datetime (self ):
696716 import datetime
697- from google .cloud ._helpers import _UTC
698717
699718 zone = self ._make_timezone (offset = datetime .timedelta (hours = - 1 ))
700719 TIMESTAMP = datetime .datetime (2016 , 4 , 5 , 13 , 30 , 0 , tzinfo = zone )
@@ -703,7 +722,6 @@ def test_w_non_utc_datetime(self):
703722
704723 def test_w_non_utc_datetime_and_ignore_zone (self ):
705724 import datetime
706- from google .cloud ._helpers import _UTC
707725
708726 zone = self ._make_timezone (offset = datetime .timedelta (hours = - 1 ))
709727 TIMESTAMP = datetime .datetime (2016 , 4 , 5 , 13 , 30 , 0 , tzinfo = zone )
0 commit comments