def test_help(self):
     fake_stdout = StringIO.StringIO()
     with parse_error(self) as fake_stderr:
         with patch("sys.stdout", fake_stdout):
             parse_args(["--help"])
     self.assertEqual("", fake_stderr.getvalue())
     self.assertIn("endpoint bindings", fake_stdout.getvalue())
Beispiel #2
0
 def test_help(self):
     fake_stdout = StringIO.StringIO()
     with parse_error(self) as fake_stderr:
         with patch('sys.stdout', fake_stdout):
             arc.parse_args(['--help'])
     self.assertEqual('', fake_stderr.getvalue())
     self.assertNotIn('TODO', fake_stdout.getvalue())
Beispiel #3
0
 def test_parse_args(self):
     with parse_error(self) as stderr:
         parse_args([])
     self.assertRegexpMatches(stderr.getvalue(), 'error: too few arguments')
     self.assertEqual(
         parse_args(['/cred/path']),
         Namespace(credential_path='/cred/path',
                   platform=sys.platform,
                   released=False,
                   revision=None,
                   verbose=0))
     self.assertEqual(
         parse_args(['/cred/path', '-r']),
         Namespace(credential_path='/cred/path',
                   platform=sys.platform,
                   released=True,
                   revision=None,
                   verbose=0))
     self.assertEqual(
         parse_args(['/cred/path', '-r', '-c', '2999', '3001']),
         Namespace(credential_path='/cred/path',
                   platform=sys.platform,
                   released=True,
                   revision=['2999', '3001'],
                   verbose=0))
 def test_help(self):
     fake_stdout = StringIO.StringIO()
     with parse_error(self) as fake_stderr:
         with patch("sys.stdout", fake_stdout):
             assess_proxy.parse_args(["--help"])
     self.assertEqual("", fake_stderr.getvalue())
     self.assertNotIn("TODO", fake_stdout.getvalue())
Beispiel #5
0
 def test_help(self):
     fake_stdout = StringIO.StringIO()
     with parse_error(self) as fake_stderr:
         with patch("sys.stdout", fake_stdout):
             a_unreg.parse_args(["--help"])
     self.assertEqual("", fake_stderr.getvalue())
     self.assertIn("Test unregister feature", fake_stdout.getvalue())
Beispiel #6
0
 def test_bad_task_bad_lex(self):
     with parse_error(self) as err_stream:
         concurrently.main(['-v', 'wrong="command'])
     self.assertIn(
         """invalid task_definition value: 'wrong="command'""",
         err_stream.getvalue())
     self.assertEqual('', self.log_stream.getvalue())
 def test_help(self):
     fake_stdout = StringIO.StringIO()
     with parse_error(self) as fake_stderr:
         with patch('sys.stdout', fake_stdout):
             arc.parse_args(['--help'])
     self.assertEqual('', fake_stderr.getvalue())
     self.assertNotIn('TODO', fake_stdout.getvalue())
Beispiel #8
0
 def test_help(self):
     fake_stdout = StringIO.StringIO()
     with parse_error(self) as fake_stderr:
         with patch("sys.stdout", fake_stdout):
             amct.parse_args(["--help"])
     self.assertEqual("", fake_stderr.getvalue())
     self.assertIn("Test Model Tree Config", fake_stdout.getvalue())
 def test_help(self):
     fake_stdout = StringIO.StringIO()
     with parse_error(self) as fake_stderr:
         with patch("sys.stdout", fake_stdout):
             a_unreg.parse_args(["--help"])
     self.assertEqual("", fake_stderr.getvalue())
     self.assertIn("Test unregister feature", fake_stdout.getvalue())
 def test_help(self):
     fake_stdout = StringIO.StringIO()
     with parse_error(self) as fake_stderr:
         with patch("sys.stdout", fake_stdout):
             aps.parse_args(["--help"])
     self.assertEqual("", fake_stderr.getvalue())
     self.assertNotIn("TODO", fake_stdout.getvalue())
 def test_help(self):
     fake_stdout = StringIO.StringIO()
     with parse_error(self) as fake_stderr:
         with patch("sys.stdout", fake_stdout):
             amct.parse_args(["--help"])
     self.assertEqual("", fake_stderr.getvalue())
     self.assertIn(
         "Test Model Tree Config", fake_stdout.getvalue())
 def test_help(self):
     fake_stdout = StringIO.StringIO()
     with parse_error(self) as fake_stderr:
         with patch('sys.stdout', fake_stdout):
             aac.parse_args(['--help'])
     self.assertEqual('', fake_stderr.getvalue())
     self.assertIn(
         'Test autoload-credentials command.', fake_stdout.getvalue())
Beispiel #13
0
 def test_native_bundle_no_name(self):
     with tests.parse_error(self) as stderr:
         parse_args(['./bundle/path', 'an_env', './juju', './logs',
                     'temp_env', '--allow-native-deploy',
                     '--bundle-name', 'specific_bundle'])
     self.assertRegexpMatches(
         stderr.getvalue(),
         'error: cannot supply bundle name with native juju deploying$')
Beispiel #14
0
 def test_help(self):
     fake_stdout = StringIO.StringIO()
     with parse_error(self) as fake_stderr:
         with patch('sys.stdout', fake_stdout):
             aac.parse_args(['--help'])
     self.assertEqual('', fake_stderr.getvalue())
     self.assertIn('Test autoload-credentials command.',
                   fake_stdout.getvalue())
 def test_help(self):
     fake_stdout = StringIO.StringIO()
     with parse_error(self) as fake_stderr:
         with patch('sys.stdout', fake_stdout):
             pl.parse_args(['--help'])
     self.assertEqual('', fake_stderr.getvalue())
     self.assertIn(
         'Perfscale longrunning test.', fake_stdout.getvalue())
Beispiel #16
0
 def test_outputs_log_on_non_failure(self):
     with patch.object(self.source_client, 'get_juju_output',
                       return_value='foo'):
         with self.assertRaises(JujuAssertionError):
             with parse_error(self) as fake_stderr:
                 amm.expect_migration_attempt_to_fail(
                     self.source_client, self.dest_client)
                 self.assertEqual(fake_stderr.getvalue(), 'foo\n')
Beispiel #17
0
def test_server(client):
    response = client.get("/slurk/api/openvidu/config")
    assert response.status_code == HTTPStatus.OK, parse_error(response)
    config = response.json

    assert config["version"] == "2.18.0"
    assert config["domain_or_public_ip"] == "localhost"
    assert config["https_port"] == 4443
    assert config["public_url"] == "https://localhost:4443"
Beispiel #18
0
 def test_help(self):
     fake_stdout = StringIO.StringIO()
     with parse_error(self) as fake_stderr:
         with patch("sys.stdout", fake_stdout):
             alf.parse_args(["--help"])
     self.assertEqual("", fake_stderr.getvalue())
     self.assertIn(
         'Test log forwarding of logs.',
         fake_stdout.getvalue())
Beispiel #19
0
 def test_native_bundle_no_name(self):
     with tests.parse_error(self) as stderr:
         parse_args([
             './bundle/path', 'an_env', './juju', './logs', 'temp_env',
             '--allow-native-deploy', '--bundle-name', 'specific_bundle'
         ])
     self.assertRegexpMatches(
         stderr.getvalue(),
         'error: cannot supply bundle name with native juju deploying$')
Beispiel #20
0
 def test_outputs_log_on_non_failure(self):
     with patch.object(self.source_client,
                       'get_juju_output',
                       return_value='foo'):
         with self.assertRaises(JujuAssertionError):
             with parse_error(self) as fake_stderr:
                 amm.expect_migration_attempt_to_fail(
                     self.source_client, self.dest_client)
                 self.assertEqual(fake_stderr.getvalue(), 'foo\n')
Beispiel #21
0
 def test_error_go_get_feature_branch(self):
     with tests.parse_error(self) as stderr:
         git_gate.parse_args(
             ["--project", "git.testing/project",
              "--project-url", "https://git.testing/project",
              "--go-get-all", "--feature-branch"])
     self.assertIn(
         "Cannot use --feature-branch and --go-get-all together",
         stderr.getvalue())
Beispiel #22
0
 def test_parse_args(self):
     with parse_error(self) as stderr:
         parse_args([])
     self.assertRegexpMatches(stderr.getvalue(), 'error: too few arguments')
     self.assertEqual(
         parse_args(['/cred/path']),
         Namespace(credential_path='/cred/path', platform=sys.platform,
                   released=False, revision=None, verbose=0))
     self.assertEqual(
         parse_args(['/cred/path', '-r']),
         Namespace(credential_path='/cred/path', platform=sys.platform,
                   released=True, revision=None, verbose=0))
     self.assertEqual(
         parse_args(['/cred/path', '-r', '-c', '2999', '3001']),
         Namespace(credential_path='/cred/path', platform=sys.platform,
                   released=True, revision=['2999', '3001'], verbose=0))
    def test_parse_args(self):
        # Test a simple command line that should work
        cmdline = ['env', '/juju', 'logs', 'ten']
        args = jcnet.parse_args(cmdline)
        self.assertEqual(args.machine_type, None)
        self.assertEqual(args.juju_bin, '/juju')
        self.assertEqual(args.env, 'env')
        self.assertEqual(args.logs, 'logs')
        self.assertEqual(args.temp_env_name, 'ten')
        self.assertEqual(args.debug, False)
        self.assertEqual(args.upload_tools, False)

        # check the optional arguments
        opts = ['--machine-type', jcnet.KVM_MACHINE, '--debug',
                '--upload-tools']
        args = jcnet.parse_args(cmdline + opts)
        self.assertEqual(args.machine_type, jcnet.KVM_MACHINE)
        self.assertEqual(args.debug, True)
        self.assertEqual(args.upload_tools, True)

        # Now check that we can only set machine_type to kvm or lxc
        opts = ['--machine-type', jcnet.LXC_MACHINE]
        args = jcnet.parse_args(cmdline + opts)
        self.assertEqual(args.machine_type, jcnet.LXC_MACHINE)

        # Machine type can also be lxd
        opts = ['--machine-type', jcnet.LXD_MACHINE]
        args = jcnet.parse_args(cmdline + opts)
        self.assertEqual(args.machine_type, jcnet.LXD_MACHINE)

        # Set up an error (bob is invalid)
        opts = ['--machine-type', 'bob']
        with parse_error(self) as stderr:
            jcnet.parse_args(cmdline + opts)
        self.assertRegexpMatches(
            stderr.getvalue(),
            ".*error: argument --machine-type: invalid choice: 'bob'.*")
Beispiel #24
0
 def test_get_juju_bin_too_few(self):
     with parse_error(self) as stderr:
         parse_args(['get-juju-bin'])
     self.assertRegexpMatches(stderr.getvalue(), 'too few arguments$')
Beispiel #25
0
 def test_error_on_project_url_missing(self):
     with tests.parse_error(self) as stderr:
         git_gate.parse_args(["--project", "git.testing/project"])
     self.assertIn(
         "Must supply either --project-url or --go-get-all",
         stderr.getvalue())
Beispiel #26
0
 def test_bad_task_missing_name(self):
     with parse_error(self) as err_stream:
         concurrently.main(['-v', 'bad'])
     self.assertIn(
         "invalid task_definition value: 'bad'", err_stream.getvalue())
     self.assertEqual('', self.log_stream.getvalue())
 def test_parse_args_signal_novalue(self):
     with parse_error(self) as stderr:
         args, command = parse_args(['500', 'foo', '--signal'])
     self.assertRegexpMatches(
         stderr.getvalue(), 'argument --signal: expected one argument')
 def test_no_upload_tools(self):
     with parse_error(self) as fake_stderr:
         parse_args(["an-env", "/bin/juju", "--upload-tools"])
     self.assertIn(
         "error: giving --upload-tools meaningless on 2.0 only test",
         fake_stderr.getvalue())
 def test_parse_args_bad_suite(self):
     with parse_error(self) as stderr:
         parse_args(['foo', '--suite', 'foo'])
     self.assertRegexpMatches(stderr.getvalue(),
                              ".*invalid choice: 'foo'.*")
Beispiel #30
0
 def test_get_juju_bin_too_few(self):
     with parse_error(self) as stderr:
         parse_args(['get-juju-bin'])
     self.assertRegexpMatches(stderr.getvalue(), 'too few arguments$')
Beispiel #31
0
 def test_parse_args_juju_home_unset(self):
     with parse_error(self) as stderr:
         parse_args([])
     self.assertRegexpMatches(stderr.getvalue(), 'Invalid JUJU_HOME value')
Beispiel #32
0
 def test_get_too_few(self):
     with parse_error(self) as stderr:
         parse_args(['get', '3275', 'job-foo'])
     self.assertRegexpMatches(stderr.getvalue(), 'too few arguments$')
 def test_bad_task_bad_lex(self):
     with parse_error(self) as err_stream:
         concurrently.main(['-v', 'wrong="command'])
     self.assertIn("""invalid task_definition value: 'wrong="command'""",
                   err_stream.getvalue())
     self.assertEqual('', self.log_stream.getvalue())
 def test_bad_task_missing_name(self):
     with parse_error(self) as err_stream:
         concurrently.main(['-v', 'bad'])
     self.assertIn("invalid task_definition value: 'bad'",
                   err_stream.getvalue())
     self.assertEqual('', self.log_stream.getvalue())
Beispiel #35
0
 def test_get_too_few(self):
     with parse_error(self) as stderr:
         parse_args(['get', '3275', 'job-foo'])
     self.assertRegexpMatches(stderr.getvalue(), 'too few arguments$')