Exemplo n.º 1
0
    def Filter(self, context, args):
        java.RequireJavaInstalled(pubsub_util.PUBSUB_TITLE)
        util.EnsureComponentIsInstalled('pubsub-emulator',
                                        pubsub_util.PUBSUB_TITLE)

        if not args.data_dir:
            args.data_dir = pubsub_util.GetDataDir()
 def testRun_WithHostPort(self):
   self.Run('beta emulators pubsub start --host-port=1.2.3.4:1111')
   self.exec_mock.assert_called_with(self.ExpectedCommand(
       ['--host=1.2.3.4', '--port=1111']), log_file=None)
   self.write_yaml_mock.assert_called_with(
       {'PUBSUB_EMULATOR_HOST': '1.2.3.4:1111'}, pubsub_util.GetDataDir())
   self.prefix_output_mock.assert_called_with('proc', pubsub_util.PUBSUB)
 def testRun_WithNoArgs(self):
   self.Run('beta emulators pubsub start')
   self.exec_mock.assert_called_with(self.ExpectedCommand(
       ['--host=localhost', '--port=9999']), log_file=None)
   self.write_yaml_mock.assert_called_with(
       {'PUBSUB_EMULATOR_HOST': 'localhost:9999'}, pubsub_util.GetDataDir())
   self.prefix_output_mock.assert_called_with('proc', pubsub_util.PUBSUB)
 def testRun_WithNoArgs(self):
   result = self.Run('beta emulators pubsub env-init')
   self.assertEqual({'foo': 'bar'}, result)
   self.read_yaml_mock.assert_called_with(pubsub_util.GetDataDir())
   self.AssertOutputContains('foo=bar')