Exemplo n.º 1
0
    def test_list_filter(self):
        """ Add a testsuite by context. """
        parser = TestsuiteTestCase.parser_create()

        testplan.api.get_or_create(testplan.api.CONTEXT, "testsuite_bob1",
                                   testplan.api.ORDER_NEXT)
        testplan.api.get_or_create(testplan.api.CONTEXT, "testsuite_bob2",
                                   testplan.api.ORDER_NEXT)
        testplan.api.get_or_create(testplan.api.CONTEXT, "testsuite_ken1",
                                   testplan.api.ORDER_NEXT)

        cmd = "testsuite add testsuite_bob1 build1"
        args = parser.parse_args(cmd.split())
        args.func(args)

        cmd = "testsuite add testsuite_bob2 build1"
        args = parser.parse_args(cmd.split())
        args.func(args)

        cmd = "testsuite add testsuite_ken1 build1"
        args = parser.parse_args(cmd.split())
        args.func(args)

        testsuites = Testsuite.contains("default", "testsuite_bob1")
        items = [item for item in testsuites]
        self.assertTrue(len(items) == 1)
        names = [item.name.name for item in items]
        self.assertEqual("testsuite_bob1", names[0])
Exemplo n.º 2
0
    def test_commands_add(self):
        """ Add a test. """

        parser = TestTestCase.parser_create()

        testplan.api.get_or_create(testplan.api.CONTEXT, "testsuite1",
                                   testplan.api.ORDER_NEXT)
        args = parser.parse_args("test add build1 testsuite1 test1".split())
        args.func(args)

        args = parser.parse_args("test add build1 testsuite1 test2".split())
        args.func(args)

        names = [item.name.name for item in Testsuite.contains("default",
                                                               "testsuite1")]
        self.assertTrue(len(names) == 1)

        names = [item.name.name for item in Test.filter("testsuite1")]
        self.assertTrue(len(names) == 2)

        self.assertTrue(any("test1" in name for name in names))
        self.assertTrue(any("test2" in name for name in names))
Exemplo n.º 3
0
    def test_commands_add(self):
        """ Add a test. """

        parser = TestTestCase.parser_create()

        testplan.api.get_or_create(testplan.api.CONTEXT, "testsuite1",
                                   testplan.api.ORDER_NEXT)
        args = parser.parse_args("test add build1 testsuite1 test1".split())
        args.func(args)

        args = parser.parse_args("test add build1 testsuite1 test2".split())
        args.func(args)

        names = [
            item.name.name
            for item in Testsuite.contains("default", "testsuite1")
        ]
        self.assertTrue(len(names) == 1)

        names = [item.name.name for item in Test.filter("testsuite1")]
        self.assertTrue(len(names) == 2)

        self.assertTrue(any("test1" in name for name in names))
        self.assertTrue(any("test2" in name for name in names))