def testGetDatastoreFromEnvNone(self):
   self.mox.StubOutWithMock(httplib2, 'Http')
   http = self.mox.CreateMockAnything()
   httplib2.Http().AndReturn(http)
   http.request('http://metadata/computeMetadata/v1/project/project-id',
                headers={'X-Google-Metadata-Request': 'True'}).AndRaise(
                    httplib2.HttpLib2Error())
   self.mox.ReplayAll()
   self.assertEquals(None, helper.get_dataset_from_env())
   self.mox.VerifyAll()
 def testGetDatastoreFromEnvNone(self):
     self.mox.StubOutWithMock(httplib2, 'Http')
     http = self.mox.CreateMockAnything()
     httplib2.Http().AndReturn(http)
     http.request('http://metadata/computeMetadata/v1/project/project-id',
                  headers={
                      'X-Google-Metadata-Request': 'True'
                  }).AndRaise(httplib2.HttpLib2Error())
     self.mox.ReplayAll()
     self.assertEquals(None, helper.get_dataset_from_env())
     self.mox.VerifyAll()
 def testGetDatastoreFromEnv(self):
   self.mox.StubOutWithMock(os, 'getenv')
   os.getenv('DATASTORE_DATASET').AndReturn('my-dataset-id')
   self.mox.ReplayAll()
   self.assertEquals('my-dataset-id', helper.get_dataset_from_env())
   self.mox.VerifyAll()
 def testGetDatastoreFromEnv(self):
     self.mox.StubOutWithMock(os, 'getenv')
     os.getenv('DATASTORE_DATASET').AndReturn('my-dataset-id')
     self.mox.ReplayAll()
     self.assertEquals('my-dataset-id', helper.get_dataset_from_env())
     self.mox.VerifyAll()