Exemplo n.º 1
0
        public void TestConfigDefaultWorks()
        {
            var cmdlet = new TestGCloudCmdlet();

            cmdlet.TestBeginProcessing();
            Assert.AreEqual(CloudSdkSettings.GetDefaultProject(), cmdlet.Project);
        }
Exemplo n.º 2
0
        public void TestGetDefaultProject()
        {
            // This test requires the default project has actually been set. Run `gcloud init`
            // after a fresh install if necessary.
            string defaultProject = CloudSdkSettings.GetDefaultProject();

            Assert.IsNotNull(defaultProject);
        }
Exemplo n.º 3
0
        public void TestGetOptInSetting()
        {
            // Just assert this doesn't throw, depending on the install the
            // value could be true or false.
            CloudSdkSettings.GetOptIntoUsageReporting();

            // Same with above. If the user opted into settings (and has ran
            // the Python bits at least once) the value will be stable.
            // Otherwise it will be different each time.
            CloudSdkSettings.GetAnoymousClientID();
        }
Exemplo n.º 4
0
        public void TestGetConfigurationFilePath()
        {
            string currentConfigName = CloudSdkSettings.GetCurrentConfigurationName();

            // If this fails it is most likely because gcloud is not installed on the machine.
            Assert.IsNotNull(currentConfigName);

            string configFilePath = CloudSdkSettings.GetCurrentConfigurationFilePath();

            Assert.IsNotNull(configFilePath);
            Assert.IsTrue(File.Exists(configFilePath));
        }
Exemplo n.º 5
0
 private static IReportCmdletResults NewTelemetryReporter()
 {
     if (CloudSdkSettings.GetOptIntoUsageReporting())
     {
         string clientID = CloudSdkSettings.GetAnoymousClientID();
         return(new GoogleAnalyticsCmdletReporter(clientID, AnalyticsEventCategory.ProviderInvocation));
     }
     else
     {
         return(new InMemoryCmdletResultReporter());
     }
 }