Exemplo n.º 1
0
 def test_version(self):
     with TestIO(combined=True) as io:
         with self.assertRaises(SystemExit) as call:
             main(['--version'])
         self.assertEqual(call.exception.args, (0,))
     self.assertEqual(io.combined, "{}\n".format(
         ToolBase.format_version_tuple(version)))
Exemplo n.º 2
0
 def test_version(self):
     with TestIO(combined=True) as io:
         with self.assertRaises(SystemExit) as call:
             main(['--version'])
         self.assertEqual(call.exception.args, (0, ))
     self.assertEqual(io.combined,
                      "{}\n".format(ToolBase.format_version_tuple(version)))
Exemplo n.º 3
0
    def test_help(self):
        with TestIO(combined=True) as io:
            with self.assertRaises(SystemExit) as call:
                main(['--help'])
        self.assertEqual(call.exception.args, (0,))
        self.maxDiff = None
        expected = """
        usage: checkbox [-h] [--version] [-v] [-D] [-C] [-T LOGGER] [-P] [-I]
                        {sru,check-config,submit,launcher,self-test} ...

        positional arguments:
          {sru,check-config,submit,launcher,self-test}
            sru                 run automated stable release update tests
            check-config        check and display plainbox configuration
            submit              submit test results to the Canonical certification
                                website
            launcher            run a customized testing session
            self-test           run unit and integration tests

        optional arguments:
          -h, --help            show this help message and exit
          --version             show program's version number and exit

        logging and debugging:
          -v, --verbose         be more verbose (same as --log-level=INFO)
          -D, --debug           enable DEBUG messages on the root logger
          -C, --debug-console   display DEBUG messages in the console
          -T LOGGER, --trace LOGGER
                                enable DEBUG messages on the specified logger (can be
                                used multiple times)
          -P, --pdb             jump into pdb (python debugger) when a command crashes
          -I, --debug-interrupt
                                crash on SIGINT/KeyboardInterrupt, useful with --pdb
        """
        self.assertEqual(io.combined, cleandoc(expected) + "\n")
Exemplo n.º 4
0
    def test_run_without_args(self):
        with TestIO(combined=True) as io:
            with self.assertRaises(SystemExit) as call:
                main([])
            self.assertEqual(call.exception.args, (2,))
        expected = """
        usage: checkbox [-h] [--version] [-v] [-D] [-C] [-T LOGGER] [-P] [-I]
                        {sru,check-config,submit,launcher,self-test} ...
        checkbox: error: too few arguments

        """
        self.assertEqual(io.combined, cleandoc(expected) + "\n")
Exemplo n.º 5
0
    def test_run_without_args(self):
        with TestIO(combined=True) as io:
            with self.assertRaises(SystemExit) as call:
                main([])
            self.assertEqual(call.exception.args, (2, ))
        expected = """
        usage: checkbox [-h] [--version] [--providers {all,stub}] [-v] [-D] [-C]
                        [-T LOGGER] [-P] [-I]
                        
                        {sru,check-config,script,dev,checkbox-cli,driver-test-suite-cli,certification-server,service}
                        ...
        checkbox: error: too few arguments

        """
        self.assertEqual(io.combined, cleandoc(expected) + "\n")
Exemplo n.º 6
0
    def test_run_without_args(self):
        with TestIO(combined=True) as io:
            with self.assertRaises(SystemExit) as call:
                main([])
            self.assertEqual(call.exception.args, (2,))
        expected = """
        usage: checkbox [-h] [--version] [-c {src,deb,auto,stub,ihv}] [-v] [-D] [-C]
                        [-T LOGGER] [-P] [-I]
                        
                        {sru,check-config,script,dev,checkbox-cli,driver-test-suite-cli,certification-server,service}
                        ...
        checkbox: error: too few arguments

        """
        self.assertEqual(io.combined, cleandoc(expected) + "\n")
Exemplo n.º 7
0
    def test_help(self):
        with TestIO(combined=True) as io:
            with self.assertRaises(SystemExit) as call:
                main(['--help'])
        self.assertEqual(call.exception.args, (0, ))
        self.maxDiff = None
        expected = """
        usage: checkbox [-h] [--version] [--providers {all,stub}] [-v] [-D] [-C]
                        [-T LOGGER] [-P] [-I]
                        
                        {sru,check-config,script,dev,checkbox-cli,driver-test-suite-cli,certification-server,service}
                        ...

        positional arguments:
          {sru,check-config,script,dev,checkbox-cli,driver-test-suite-cli,certification-server,service}
            sru                 run automated stable release update tests
            check-config        check and display plainbox configuration
            script              run a command from a job
            dev                 development commands
            checkbox-cli        application for system testing
            driver-test-suite-cli
                                driver test suite application
            certification-server
                                application for server certification
            service             spawn dbus service

        optional arguments:
          -h, --help            show this help message and exit
          --version             show program's version number and exit

        provider list and development:
          --providers {all,stub}
                                which providers to load

        logging and debugging:
          -v, --verbose         be more verbose (same as --log-level=INFO)
          -D, --debug           enable DEBUG messages on the root logger
          -C, --debug-console   display DEBUG messages in the console
          -T LOGGER, --trace LOGGER
                                enable DEBUG messages on the specified logger (can be
                                used multiple times)
          -P, --pdb             jump into pdb (python debugger) when a command crashes
          -I, --debug-interrupt
                                crash on SIGINT/KeyboardInterrupt, useful with --pdb
        """
        self.assertEqual(io.combined, cleandoc(expected) + "\n")
Exemplo n.º 8
0
    def test_help(self):
        with TestIO(combined=True) as io:
            with self.assertRaises(SystemExit) as call:
                main(['--help'])
        self.assertEqual(call.exception.args, (0,))
        self.maxDiff = None
        expected = """
        usage: checkbox [-h] [--version] [--providers {all,stub}] [-v] [-D] [-C]
                        [-T LOGGER] [-P] [-I]
                        
                        {sru,check-config,script,dev,checkbox-cli,driver-test-suite-cli,certification-server,service}
                        ...

        positional arguments:
          {sru,check-config,script,dev,checkbox-cli,driver-test-suite-cli,certification-server,service}
            sru                 run automated stable release update tests
            check-config        check and display plainbox configuration
            script              run a command from a job
            dev                 development commands
            checkbox-cli        application for system testing
            driver-test-suite-cli
                                driver test suite application
            certification-server
                                application for server certification
            service             spawn dbus service

        optional arguments:
          -h, --help            show this help message and exit
          --version             show program's version number and exit

        provider list and development:
          --providers {all,stub}
                                which providers to load

        logging and debugging:
          -v, --verbose         be more verbose (same as --log-level=INFO)
          -D, --debug           enable DEBUG messages on the root logger
          -C, --debug-console   display DEBUG messages in the console
          -T LOGGER, --trace LOGGER
                                enable DEBUG messages on the specified logger (can be
                                used multiple times)
          -P, --pdb             jump into pdb (python debugger) when a command crashes
          -I, --debug-interrupt
                                crash on SIGINT/KeyboardInterrupt, useful with --pdb
        """
        self.assertEqual(io.combined, cleandoc(expected) + "\n")
Exemplo n.º 9
0
    def test_help(self):
        with TestIO(combined=True) as io:
            with self.assertRaises(SystemExit) as call:
                main(['sru', '--help'])
            self.assertEqual(call.exception.args, (0, ))
        self.maxDiff = None
        expected = """
        usage: checkbox sru [-h] --secure_id SECURE-ID [-T TEST-PLAN-ID] [--staging]
                            [--check-config]

        optional arguments:
          -h, --help            show this help message and exit
          --secure_id SECURE-ID
                                Canonical hardware identifier
          -T TEST-PLAN-ID, --test-plan TEST-PLAN-ID
                                load the specified test plan
          --staging             Send the data to non-production test server
          --check-config        run check-config before starting
        """
        self.assertEqual(io.combined, cleandoc(expected) + "\n")
Exemplo n.º 10
0
    def test_help(self):
        with TestIO(combined=True) as io:
            with self.assertRaises(SystemExit) as call:
                main(['sru', '--help'])
            self.assertEqual(call.exception.args, (0,))
        self.maxDiff = None
        expected = """
        usage: checkbox sru [-h] [--check-config] --secure-id SECURE-ID
                            [--fallback FILE] [--destination URL] [--staging] [-n]
                            [-i PATTERN] [-x PATTERN] [-w WHITELIST]

        optional arguments:
          -h, --help            show this help message and exit
          --check-config        Run plainbox check-config before starting

        sru-specific options:
          --secure-id SECURE-ID
                                Associate submission with a machine using this SECURE-
                                ID (unset)
          --fallback FILE       If submission fails save the test report as FILE
                                (unset)
          --destination URL     POST the test report XML to this URL (https://certific
                                ation.canonical.com/submissions/submit/)
          --staging             Override --destination to use the staging
                                certification website

        execution options:
          -n, --dry-run         Skip all usual jobs. Only local, resource and
                                attachment jobs are started

        job definition options:
          -i PATTERN, --include-pattern PATTERN
                                Run jobs matching the given regular expression.
                                Matches from the start to the end of the line.
          -x PATTERN, --exclude-pattern PATTERN
                                Do not run jobs matching the given regular expression.
                                Matches from the start to the end of the line.
          -w WHITELIST, --whitelist WHITELIST
                                Load whitelist containing run patterns
        """
        self.assertEqual(io.combined, cleandoc(expected) + "\n")
Exemplo n.º 11
0
    def test_help(self):
        with TestIO(combined=True) as io:
            with self.assertRaises(SystemExit) as call:
                main(['sru', '--help'])
            self.assertEqual(call.exception.args, (0, ))
        self.maxDiff = None
        expected = """
        usage: checkbox sru [-h] [--check-config] --secure-id SECURE-ID
                            [--fallback FILE] [--destination URL] [--staging] [-n]
                            [-i PATTERN] [-x PATTERN] [-w WHITELIST]

        optional arguments:
          -h, --help            show this help message and exit
          --check-config        Run plainbox check-config before starting

        sru-specific options:
          --secure-id SECURE-ID
                                Associate submission with a machine using this SECURE-
                                ID (unset)
          --fallback FILE       If submission fails save the test report as FILE
                                (unset)
          --destination URL     POST the test report XML to this URL (https://certific
                                ation.canonical.com/submissions/submit/)
          --staging             Override --destination to use the staging
                                certification website

        execution options:
          -n, --dry-run         Skip all usual jobs. Only local, resource and
                                attachment jobs are started

        job definition options:
          -i PATTERN, --include-pattern PATTERN
                                include jobs matching the given regular expression
          -x PATTERN, --exclude-pattern PATTERN
                                exclude jobs matching the given regular expression
          -w WHITELIST, --whitelist WHITELIST
                                load whitelist containing run patterns
        """
        self.assertEqual(io.combined, cleandoc(expected) + "\n")