Example #1
0
 def testCredentialHelperGcloudWithSpacesAndFullPath(self):
   with mock.patch(
       'googlecloudsdk.core.util.files.FindExecutableOnPath') as find_gcloud:
     find_gcloud.return_value = '/path/google cloud SDK/gcloud'
     gcloud = git._GetGcloudScript(full_path=True)
     self.AssertErrContains('credential helper may not work correctly')
     self.assertEqual(gcloud, '/path/google cloud SDK/gcloud')
Example #2
0
 def testCredentialHelperGcloudWithSpaces(self):
   with mock.patch(
       'googlecloudsdk.core.util.files.FindExecutableOnPath') as find_gcloud:
     find_gcloud.return_value = '/path/google cloud SDK/gcloud'
     gcloud = git._GetGcloudScript()
     # ignore .cmd suffix
     self.assertEqual(gcloud[:6], 'gcloud')
Example #3
0
 def testCredentialHelperGoodGcloudPathFullPathFalse(self):
   with mock.patch(
       'googlecloudsdk.core.util.files.FindExecutableOnPath') as find_gcloud:
     find_gcloud.return_value = 'abC/1234/has-hyphen/with_underscore/gcloud'
     gcloud = git._GetGcloudScript()
     # ignore .cmd suffix
     self.assertEqual(gcloud[:6], 'gcloud')
Example #4
0
 def testCredentialHelperGoodGcloudPathFullPathTrue(self):
   with mock.patch(
       'googlecloudsdk.core.util.files.FindExecutableOnPath') as find_gcloud:
     find_gcloud.return_value = 'abC/1234/has-hyphen/with_underscore/gcloud'
     gcloud = git._GetGcloudScript(full_path=True)
     self.AssertErrNotContains('credential helper may not work correctly')
     self.assertEqual(gcloud, 'abC/1234/has-hyphen/with_underscore/gcloud')
Example #5
0
  def testCredentialHelperFindableFromInstall(self):
    with mock.patch.dict('os.environ', {'PATH': config.Paths().sdk_bin_path}):
      gcloud = git._GetGcloudScript()

    self.assertIsNotNone(gcloud)
    self.assertTrue(
        os.path.exists(os.path.join(config.Paths().sdk_bin_path, gcloud)) or
        gcloud == (config.Paths().sdk_bin_path + '/gcloud'))