Ejemplo n.º 1
0
    def _fixture_setup(self):
        super()._fixture_setup()

        self.user = UserFactory()
        self.execution = TestExecutionFactory()
Ejemplo n.º 2
0
    def setUpTestData(cls):
        super(TestAJAXSearchRuns, cls).setUpTestData()

        cls.search_url = reverse('testruns-ajax_search')

        # Add more test runs for testing different search criterias

        cls.run_tester = UserFactory(username='******',
                                     email='*****@*****.**')

        cls.product_issuetracker = ProductFactory(name='issuetracker')
        cls.version_issuetracker_0_1 = VersionFactory(
            value='0.1', product=cls.product_issuetracker)
        cls.version_issuetracker_1_2 = VersionFactory(
            value='1.2', product=cls.product_issuetracker)

        cls.plan_issuetracker = TestPlanFactory(
            name='Test issue tracker releases',
            author=cls.tester,
            owner=cls.tester,
            product=cls.product_issuetracker,
            product_version=cls.version_issuetracker_0_1)

        # Probably need more cases as well in order to create case runs to
        # test statistcis in search result

        cls.build_issuetracker_fast = BuildFactory(
            product=cls.product_issuetracker)

        cls.run_hotfix = TestRunFactory(
            summary='Fast verify hotfix',
            product_version=cls.version_issuetracker_0_1,
            plan=cls.plan_issuetracker,
            build=cls.build_issuetracker_fast,
            manager=cls.tester,
            default_tester=cls.run_tester,
            tag=[TagFactory(name='fedora'),
                 TagFactory(name='rhel')])

        cls.run_release = TestRunFactory(
            summary='Smoke test before release',
            product_version=cls.version_issuetracker_1_2,
            plan=cls.plan_issuetracker,
            build=cls.build_issuetracker_fast,
            manager=cls.tester,
            default_tester=cls.run_tester)

        cls.run_daily = TestRunFactory(
            summary='Daily test during sprint',
            product_version=cls.version_issuetracker_0_1,
            plan=cls.plan_issuetracker,
            build=cls.build_issuetracker_fast,
            manager=cls.tester,
            default_tester=cls.run_tester,
            tag=[TagFactory(name='rhel')])

        # test data for Issue #78
        # https://github.com/kiwitcms/Kiwi/issues/78
        cls.run_bogus_summary = TestRunFactory(
            summary=
            r"""A summary with backslash(\), single quotes(') and double quotes(")""",
            manager=cls.tester,
            default_tester=UserFactory(username='******',
                                       email='*****@*****.**'))

        cls.search_data = {
            'action': 'search',
            # Add criteria for searching runs in each test

            # DataTable properties: pagination and sorting
            'sEcho': 1,
            'iDisplayStart': 0,
            # Make enough length to display all searched runs in one page
            'iDisplayLength': TestRun.objects.count() + 1,
            'iSortCol_0': 1,
            'sSortDir_0': 'asc',
            'iSortingCols': 1,
            # In the view, first column is not sortable.
            'bSortable_0': 'false',
            'bSortable_1': 'true',
            'bSortable_2': 'true',
            'bSortable_3': 'true',
            'bSortable_4': 'true',
            'bSortable_5': 'true',
            'bSortable_6': 'true',
            'bSortable_7': 'true',
            'bSortable_8': 'true',
            'bSortable_9': 'true',
            'bSortable_10': 'true',
            'bSortable_11': 'true',
        }
Ejemplo n.º 3
0
 def setUpTestData(cls):
     cls.user = UserFactory(username='******', email='*****@*****.**')
     cls.user_field = UserField()
Ejemplo n.º 4
0
 def setUpTestData(cls):
     cls.new_user = UserFactory()
     cls.origin_activation_key = UserActivationKey.set_random_key_for_user(
         cls.new_user)
Ejemplo n.º 5
0
 def setUpTestData(cls):
     cls.user = UserFactory()
     cls.http_req = make_http_request(user=cls.user)
Ejemplo n.º 6
0
 def setUpTestData(cls):
     cls.tester = UserFactory()
     cls.tester.set_password('password')
     cls.tester.save()
Ejemplo n.º 7
0
 def setUpTestData(cls):
     cls.new_user = UserFactory()
Ejemplo n.º 8
0
    def setUpTestData(cls):
        super().setUpTestData()

        cls.another_plan = TestPlanFactory(
            name="Another plan for test",
            author=cls.tester,
            product=cls.product,
            product_version=cls.version,
        )
        cls.another_case_1 = TestCaseFactory(
            author=cls.tester,
            default_tester=None,
            reviewer=cls.tester,
            plan=[cls.another_plan],
        )
        cls.another_case_2 = TestCaseFactory(
            author=cls.tester,
            default_tester=None,
            reviewer=cls.tester,
            plan=[cls.another_plan],
        )

        cls.third_plan = TestPlanFactory(
            name="Third plan for test",
            author=cls.tester,
            product=cls.product,
            product_version=cls.version,
        )
        cls.third_case_1 = TestCaseFactory(
            author=cls.tester,
            default_tester=None,
            reviewer=cls.tester,
            plan=[cls.third_plan],
        )
        cls.third_case_2 = TestCaseFactory(
            author=cls.tester,
            default_tester=None,
            reviewer=cls.tester,
            plan=[cls.third_plan],
        )

        cls.totally_new_plan = TestPlanFactory(
            name="Test clone plan with copying cases",
            author=cls.tester,
            product=cls.product,
            product_version=cls.version,
        )
        cls.case_maintain_original_author = TestCaseFactory(
            author=cls.tester,
            default_tester=None,
            reviewer=cls.tester,
            plan=[cls.totally_new_plan],
        )
        cls.case_keep_default_tester = TestCaseFactory(
            author=cls.tester,
            default_tester=None,
            reviewer=cls.tester,
            plan=[cls.totally_new_plan],
        )

        cls.plan_tester = UserFactory()
        cls.plan_tester.set_password("password")
        cls.plan_tester.save()
        user_should_have_perm(cls.plan_tester, "testplans.add_testplan")
        user_should_have_perm(cls.plan_tester, "testplans.view_testplan")
Ejemplo n.º 9
0
    def _fixture_setup(self):
        # restore the serialized data from initial migrations
        # this includes default groups and permissions
        super(BaseAPIClient_TestCase, self)._fixture_setup()

        # initial cache reset to avoid storing anything in cache
        tcms_api.config.set_cache_level(tcms_api.config.CACHE_NONE)

        # reset connection to server b/c the address changes for
        # every test and the client caches this as a class attribute
        tcms_api.TCMS._connection = None
        # also the config is a singleton so reset that too
        # to force config reload
        tcms_api.Config._instance = None

        # API user
        self.api_user, _ = User.objects.get_or_create(username='******',
                                                      email='*****@*****.**')
        self.api_user.set_password('testing')
        initiate_user_with_default_setups(self.api_user)

        # WARNING: for now we override the config file
        # until we can pass the testing configuration
        # TODO: change config values instead of overwriting files on disk
        conf_path = os.path.expanduser('~/.tcms.conf')
        conf_fh = open(conf_path, 'w')
        conf_fh.write("""[tcms]
url = %s/xml-rpc/
username = %s
password = %s
""" % (self.live_server_url, self.api_user.username, 'testing'))
        conf_fh.close()

        # create the product first so we can fetch it via API
        f_product = ProductFactory()
        self.product = tcms_api.Product(name=f_product.name)
        f_version = VersionFactory(product=f_product)
        self.version = tcms_api.Version(product=self.product,
                                        version=f_version.value)
        self.plantype = tcms_api.PlanType(name="Function")

        TestCaseCategoryFactory(name='Security', product=f_product)
        TestCaseCategoryFactory(name='Sanity', product=f_product)
        f_category = TestCaseCategoryFactory(product=f_product)
        self.category = tcms_api.Category(category=f_category.name,
                                          product=self.product)

        f_component = ComponentFactory(product=f_product)
        self.component = tcms_api.Component(name=f_component.name,
                                            product=self.product)
        self.CASESTATUS = tcms_api.CaseStatus("CONFIRMED")
        self.build = tcms_api.Build(product=self.product, build="unspecified")

        f_tags = [TestTagFactory() for i in range(20)]
        self.tags = [tcms_api.Tag(t.pk) for t in f_tags]

        f_users = [UserFactory() for i in range(50)]
        self.TESTERS = [tcms_api.User(u.pk) for u in f_users]

        # Create test cases
        self.cases = []
        for case_count in range(self.num_cases):
            testcase = tcms_api.TestCase(
                category=self.category,
                product=self.product,
                summary="Test Case {0}".format(case_count + 1),
                status=self.CASESTATUS)
            # Add a couple of random tags and the default tester
            testcase.tags.add(
                [random.choice(self.tags) for counter in range(10)])
            testcase.tester = random.choice(self.TESTERS)
            testcase.update()
            self.cases.append(testcase)

        # Create master test plan (parent of all)
        self.master = tcms_api.TestPlan(name="API client Test Plan",
                                        text='Master TP created from API',
                                        product=self.product,
                                        version=self.version,
                                        type=self.plantype)
        self.master.owner = self.api_user
        self.master.testcases.add(self.cases)
        self.master.update()

        # Create child test plans
        self.testruns = []
        for plan_count in range(self.num_plans):
            testplan = tcms_api.TestPlan(
                name="Test Plan {0}".format(plan_count + 1),
                text='Child TP created from API',
                product=self.product,
                version=self.version,
                parent=self.master,
                type=self.plantype)
            # Link all test cases to the test plan
            testplan.testcases.add(self.cases)
            testplan.update()

            # Create test runs
            for run_count in range(self.num_runs):
                testrun = tcms_api.TestRun(
                    testplan=testplan,
                    build=self.build,
                    product=self.product,
                    summary="Test Run {0}".format(run_count + 1),
                    version=self.version.name)
                self.testruns.append(testrun)

        # Create a TestCaseRun object
        self.caserun = TestCaseRunFactory()
        self.caserun.add_bug(1234, TestCaseBugSystem.objects.first().pk)
Ejemplo n.º 10
0
 def setUpTestData(cls):
     cls.author = UserFactory(username='******', email='*****@*****.**')
     cls.plan = TestPlanFactory(author=cls.author, owner=cls.author)
     cls.http_req = make_http_request(user=cls.author)
Ejemplo n.º 11
0
 def setUpTestData(cls):
     cls.http_req = make_http_request()
     cls.user = UserFactory()
     cls.product = ProductFactory()
     cls.plan = TestPlanFactory(author=cls.user, owner=cls.user, product=cls.product)
Ejemplo n.º 12
0
 def setUpTestData(cls):
     super(TestNavigation, cls).setUpTestData()
     cls.user = UserFactory(email='*****@*****.**')
     cls.user.set_password('testing')
     cls.user.save()
Ejemplo n.º 13
0
 def setUpTestData(cls):
     cls.product = ProductFactory(name='Nitrate')
     cls.build = TestBuildFactory(product=cls.product)
     cls.user = UserFactory()
     cls.case_run_1 = TestCaseRunFactory(assignee=cls.user, build=cls.build)
     cls.case_run_2 = TestCaseRunFactory(assignee=cls.user, build=cls.build)
Ejemplo n.º 14
0
    def setUpTestData(cls):
        super().setUpTestData()

        cls.reviewer = UserFactory()