def test_not_on_gcp(self, mock_requests_get):
        mock_requests_get.side_effect = requests.exceptions.ConnectionError()

        self.assertEqual(cloud_lib.on_gcp(), False)
예제 #2
0
def _collect_test_environment(run_info):
    """Detect the local environment, eg GCE, AWS or DGX, etc."""
    if cloud_lib.on_gcp():
        run_info["test_environment"] = GCP_TEST_ENV
    def test_on_gcp(self, mock_requests_get):
        mock_response = mock.MagicMock()
        mock_requests_get.return_value = mock_response
        mock_response.status_code = 200

        self.assertEqual(cloud_lib.on_gcp(), True)