def get_function(self, events=(), factory=None, **kw):
     if not events:
         assert factory
         events = [mu.HTTPEvent(factory)]
     config = dict(name="custodian-dev",
                   labels=[],
                   runtime='python37',
                   events=events)
     config.update(kw)
     archive = mu.custodian_archive()
     archive.close()
     return mu.CloudFunction(config, archive)
Esempio n. 2
0
 def get_function(self, events=(), factory=None, **kw):
     if not events:
         assert factory
         events = [mu.HTTPEvent(factory)]
     config = dict(
         name="custodian-dev",
         labels=[],
         runtime='python37',
         events=events)
     config.update(kw)
     archive = mu.custodian_archive()
     archive.close()
     return mu.CloudFunction(config, archive)
Esempio n. 3
0
 def test_deploy_function(self):
     factory = self.replay_flight_data('mu-deploy')
     self.maxDiff = None
     config = dict(name="custodian-dev",
                   labels=[],
                   runtime='nodejs6',
                   events=[HTTPEvent(factory)])
     archive = custodian_archive()
     func = CloudFunction(config, archive)
     manager = CloudFunctionManager(factory)
     manager.publish(func)
     func_info = manager.get(func.name)
     self.assertTrue(func_info['httpsTrigger'])
     self.assertEqual(func_info['status'], 'DEPLOY_IN_PROGRESS')
     self.assertEqual(
         func_info['name'],
         'projects/custodian-1291/locations/us-central1/functions/custodian-dev'
     )