Exemplo n.º 1
0
    def test_should_have_default_executable_arguments_if_no_config_specified(
            self):
        test_args = ['VRN1', 'admin', 'adminpass']

        options = _parse_args(True, test_args)

        expectations = {
            'servers': [{
                'host': 'VRN1',
                'username': '******',
                'password': '******'
            }],
            'wsgi_server':
            'twisted',
            'port':
            8080,
            'stat_window':
            5,
            'test':
            False,
            'config_file':
            ''
        }

        self.assertEquals(expectations, options)
Exemplo n.º 2
0
    def test_should_have_supplied_arguments_if_no_config_specified(self):
        test_args = [
            'VRN1', 'admin', 'adminpass', '-w', 'paste', '-p', '8091', '-s',
            '15'
        ]

        options = _parse_args(False, test_args)

        expectations = {
            'servers': [{
                'host': 'VRN1',
                'username': '******',
                'password': '******'
            }],
            'wsgi_server':
            'paste',
            'port':
            8091,
            'stat_window':
            15,
            'test':
            False,
            'config_file':
            ''
        }

        self.assertEquals(expectations, options)
Exemplo n.º 3
0
 def test_should_not_have_required_arguments_if_config_specified(self):
     args = ['-c', 'dummy_file', '-p', '8091', '-s', '15', '-w', 'twisted']
                  
     options = _parse_args(False, args)
     expectations = {'wsgi_server': 'twisted', 'port': 8091, 
                     'stat_window': 15, 'test': False, 
                     'config_file': 'dummy_file'}
     
     self.assertEquals(expectations, options)
Exemplo n.º 4
0
 def test_should_handle_test_arguments(self):
     test_args = ['--test', '-w', 'gunicorn', '-p', '8091', '-s', '15']
                  
     options = _parse_args(False, test_args)
     
     expectations = {'wsgi_server': 'gunicorn', 'port': 8091, 
                     'stat_window': 15, 'test': True,
                     'config_file': ''}
     
     self.assertEquals(expectations, options)
Exemplo n.º 5
0
 def test_should_have_supplied_executable_arguments_if_no_config_specified(self):
     args = ['VRN1', 'admin', 'adminpass', '-p', '8091', '-s', '15']
                  
     options = _parse_args(True, args)
     expectations = {'servers': [{'host': 'VRN1', 'username': '******', 
                     'password': '******'}], 'wsgi_server': 'twisted',
                     'port': 8091, 'stat_window': 15, 'test': False,
                     'config_file': ''}
     
     self.assertEquals(expectations, options)
Exemplo n.º 6
0
 def test_should_have_default_arguments_if_no_config_specified(self):
     args = ['VRN1', 'admin', 'adminpass']
                  
     options = _parse_args(False, args)
     
     expectations = {'servers': [{'host': 'VRN1', 'username': '******', 
                     'password': '******'}], 'wsgi_server': 'wsgiref',
                     'port': 8080, 'stat_window': 5, 'test': False,
                     'config_file': ''}
     
     self.assertEquals(expectations, options)
Exemplo n.º 7
0
 def test_should_not_add_handle_test_and_executable_arguments(self):
     test_args = ['--test']
     
     old_stderr = sys.stderr
     sys.stderr = StringIO()
     try:
         options = _parse_args(True, test_args)
         self.fail('Should throw an error because --test is not allow with executable')
     except SystemExit:
         pass
     finally:
         sys.stderr = old_stderr
Exemplo n.º 8
0
    def test_should_not_have_required_arguments_if_config_specified(self):
        args = ['-c', 'dummy_file', '-p', '8091', '-s', '15', '-w', 'twisted']

        options = _parse_args(False, args)
        expectations = {
            'wsgi_server': 'twisted',
            'port': 8091,
            'stat_window': 15,
            'test': False,
            'config_file': 'dummy_file'
        }

        self.assertEquals(expectations, options)
Exemplo n.º 9
0
    def test_should_not_add_handle_test_and_executable_arguments(self):
        test_args = ['--test']

        old_stderr = sys.stderr
        sys.stderr = StringIO()
        try:
            options = _parse_args(True, test_args)
            self.fail(
                'Should throw an error because --test is not allow with executable'
            )
        except SystemExit:
            pass
        finally:
            sys.stderr = old_stderr
Exemplo n.º 10
0
    def test_should_handle_test_arguments(self):
        test_args = ['--test', '-w', 'gunicorn', '-p', '8091', '-s', '15']

        options = _parse_args(False, test_args)

        expectations = {
            'wsgi_server': 'gunicorn',
            'port': 8091,
            'stat_window': 15,
            'test': True,
            'config_file': ''
        }

        self.assertEquals(expectations, options)