Ejemplo n.º 1
0
    def test_parse_good_args(self):
        args = upload_file.parse_args(['--relation', 'tmp',
                                       'testdata/TwitterK.csv'])
        eq_(args.hostname, 'rest.myria.cs.washington.edu')
        eq_(args.port, 1776)
        eq_(args.program, 'adhoc')
        eq_(args.user, 'public')
        eq_(args.program, 'adhoc')
        eq_(args.relation, 'tmp')
        eq_(args.overwrite, False)
        eq_(args.ssl, True)

        args = upload_file.parse_args(['--relation', 'tmp',
                                       '--program', 'face',
                                       '--user', 'mom',
                                       '--overwrite',
                                       '--hostname', 'localhost',
                                       '--port', '12345',
                                       '--no-ssl',
                                       'testdata/TwitterK.csv'])
        eq_(args.hostname, 'localhost')
        eq_(args.port, 12345)
        eq_(args.user, 'mom')
        eq_(args.program, 'face')
        eq_(args.relation, 'tmp')
        eq_(args.overwrite, True)
        eq_(args.ssl, False)
Ejemplo n.º 2
0
    def test_parse_bad_args(self):
        with QuietStderr():
            # Missing one or both required arguments
            with assert_raises(SystemExit):
                args = upload_file.parse_args()
            with assert_raises(SystemExit):
                try:
                    args = upload_file.parse_args(['nosuchfile'])
                except IOError:
                    raise SystemExit()

            # Illegal file
            with assert_raises(SystemExit):
                try:
                    args = upload_file.parse_args(['--relation', 'tmp',
                                                   'nosuchfile'])
                except IOError:
                    raise SystemExit()

            # Bad port
            with assert_raises(SystemExit):
                args = upload_file.parse_args(['--relation', 'tmp',
                                               '--port', 'abc',
                                               'testdata/TwitterK.csv'])
            with assert_raises(SystemExit):
                args = upload_file.parse_args(['--relation', 'tmp',
                                               '--port', '-1',
                                               'testdata/TwitterK.csv'])
            with assert_raises(SystemExit):
                args = upload_file.parse_args(['--relation', 'tmp',
                                               '--port', '65536',
                                               'testdata/TwitterK.csv'])
Ejemplo n.º 3
0
    def test_parse_bad_args(self):
        with QuietStderr():
            # Missing one or both required arguments
            with assert_raises(SystemExit):
                args = upload_file.parse_args()
            with assert_raises(SystemExit):
                try:
                    args = upload_file.parse_args(['nosuchfile'])
                except IOError:
                    raise SystemExit()

            # Illegal file
            with assert_raises(SystemExit):
                try:
                    args = upload_file.parse_args(
                        ['--relation', 'tmp', 'nosuchfile'])
                except IOError:
                    raise SystemExit()

            # Bad port
            with assert_raises(SystemExit):
                args = upload_file.parse_args([
                    '--relation', 'tmp', '--port', 'abc',
                    'testdata/TwitterK.csv'
                ])
            with assert_raises(SystemExit):
                args = upload_file.parse_args([
                    '--relation', 'tmp', '--port', '-1',
                    'testdata/TwitterK.csv'
                ])
            with assert_raises(SystemExit):
                args = upload_file.parse_args([
                    '--relation', 'tmp', '--port', '65536',
                    'testdata/TwitterK.csv'
                ])
Ejemplo n.º 4
0
    def test_parse_good_args(self):
        args = upload_file.parse_args(
            ['--relation', 'tmp', 'testdata/TwitterK.csv'])
        eq_(args.hostname, 'rest.myria.cs.washington.edu')
        eq_(args.port, 1776)
        eq_(args.program, 'adhoc')
        eq_(args.user, 'public')
        eq_(args.program, 'adhoc')
        eq_(args.relation, 'tmp')
        eq_(args.overwrite, False)
        eq_(args.ssl, True)

        args = upload_file.parse_args([
            '--relation', 'tmp', '--program', 'face', '--user', 'mom',
            '--overwrite', '--hostname', 'localhost', '--port', '12345',
            '--no-ssl', 'testdata/TwitterK.csv'
        ])
        eq_(args.hostname, 'localhost')
        eq_(args.port, 12345)
        eq_(args.user, 'mom')
        eq_(args.program, 'face')
        eq_(args.relation, 'tmp')
        eq_(args.overwrite, True)
        eq_(args.ssl, False)