Пример #1
0
    def setUpTestData(cls):
        cls.product = ProductFactory()
        cls.request = HttpRequest()

        cls.info_objects = _InfoObjects(cls.request, cls.product.pk)

        cls.build_one = BuildFactory(product=cls.product)
        cls.build_two = BuildFactory(product=cls.product)
        cls.build_two.is_active = False
        cls.build_two.save()

        cls.category_one = CategoryFactory(product=cls.product)
        cls.category_two = CategoryFactory(product=cls.product)
        cls.category_three = CategoryFactory()

        cls.component_one = ComponentFactory(product=cls.product)
        cls.component_two = ComponentFactory(product=cls.product)
        cls.component_three = ComponentFactory()

        cls.env_group_one = EnvGroupFactory()
        cls.env_group_two = EnvGroupFactory()

        cls.env_property_one = EnvPropertyFactory()
        cls.env_property_two = EnvPropertyFactory()
        EnvGroupPropertyMapFactory(group=cls.env_group_one, property=cls.env_property_one)

        cls.env_value_one = EnvValueFactory(property=cls.env_property_one)
        cls.env_value_two = EnvValueFactory()

        cls.user_one = UserFactory()
        cls.user_two = UserFactory()

        cls.version_one = VersionFactory(product=cls.product)
        cls.version_two = VersionFactory()
Пример #2
0
    def setUpTestData(cls):
        cls.product = ProductFactory()

        cls.default_category = Category.objects.get(name='--default--')
        cls.category_one = CategoryFactory(product=cls.product)
        cls.category_two = CategoryFactory(product=cls.product)

        cls.categories = [cls.default_category, cls.category_one, cls.category_two]
Пример #3
0
    def setUpTestData(cls):
        super(TestOperateCategoryView, cls).setUpTestData()

        cls.case_cat_full_auto = CategoryFactory(name='Full Auto', product=cls.product)
        cls.case_cat_full_manual = CategoryFactory(name='Full Manual', product=cls.product)

        user_should_have_perm(cls.tester, 'testcases.add_testcasecomponent')

        cls.case_category_url = reverse('testcases-category')
Пример #4
0
    def _fixture_setup(self):
        super(TestCategory, self)._fixture_setup()

        self.product_nitrate = ProductFactory(name='nitrate')
        self.product_xmlrpc = ProductFactory(name='xmlrpc')
        self.case_categories = [
            CategoryFactory(name='auto', product=self.product_nitrate),
            CategoryFactory(name='manual', product=self.product_nitrate),
            CategoryFactory(name='pending', product=self.product_xmlrpc),
        ]
Пример #5
0
    def _fixture_setup(self):
        super()._fixture_setup()

        self.product_nitrate = ProductFactory(name="nitrate")
        self.product_xmlrpc = ProductFactory(name="xmlrpc")
        self.case_categories = [
            CategoryFactory(name="auto", product=self.product_nitrate),
            CategoryFactory(name="manual", product=self.product_nitrate),
            CategoryFactory(name="pending", product=self.product_xmlrpc),
        ]
Пример #6
0
    def setUpTestData(cls):
        cls.product = ProductFactory()
        cls.request = HttpRequest()

        cls.info_objects = _InfoObjects(cls.request, cls.product.pk)

        cls.category_one = CategoryFactory(product=cls.product)
        cls.category_two = CategoryFactory(product=cls.product)
        cls.category_three = CategoryFactory()

        cls.component_one = ComponentFactory(product=cls.product)
        cls.component_two = ComponentFactory(product=cls.product)
        cls.component_three = ComponentFactory()

        cls.user_one = UserFactory()
        cls.user_two = UserFactory()
Пример #7
0
    def setUpTestData(cls):
        cls.product = ProductFactory()
        cls.request = HttpRequest()

        cls.info_objects = _InfoObjects(cls.request, cls.product.pk)

        cls.build_one = BuildFactory(product=cls.product)
        cls.build_two = BuildFactory(product=cls.product)
        cls.build_two.is_active = False
        cls.build_two.save()

        cls.category_one = CategoryFactory(product=cls.product)
        cls.category_two = CategoryFactory(product=cls.product)
        cls.category_three = CategoryFactory()

        cls.component_one = ComponentFactory(product=cls.product)
        cls.component_two = ComponentFactory(product=cls.product)
        cls.component_three = ComponentFactory()

        cls.user_one = UserFactory()
        cls.user_two = UserFactory()

        cls.version_one = VersionFactory(product=cls.product)
        cls.version_two = VersionFactory()
Пример #8
0
    def _fixture_setup(self):
        super(TestFilterCases, self)._fixture_setup()

        self.tester = UserFactory(username='******')
        self.product = ProductFactory(name='StarCraft')
        self.version = VersionFactory(value='0.1', product=self.product)
        self.plan = TestPlanFactory(name='Test product.get_cases',
                                    owner=self.tester, author=self.tester,
                                    product=self.product,
                                    product_version=self.version)
        self.case_category = CategoryFactory(product=self.product)
        self.cases_count = 10
        self.cases = [TestCaseFactory(category=self.case_category, author=self.tester,
                                      reviewer=self.tester, default_tester=None,
                                      plan=[self.plan])
                      for i in range(self.cases_count)]
Пример #9
0
    def _fixture_setup(self):
        super()._fixture_setup()

        self.tester = UserFactory(username="******")
        self.product = ProductFactory(name="StarCraft")
        self.version = VersionFactory(value="0.1", product=self.product)
        self.plan = TestPlanFactory(
            name="Test product.get_cases",
            author=self.tester,
            product=self.product,
            product_version=self.version,
        )
        self.case_category = CategoryFactory(product=self.product)
        self.cases_count = 10
        self.cases = []
        for _ in range(self.cases_count):
            test_case = TestCaseFactory(
                category=self.case_category,
                author=self.tester,
                reviewer=self.tester,
                default_tester=None,
                plan=[self.plan],
            )
            self.cases.append(test_case)
Пример #10
0
    def _fixture_setup(self):
        super()._fixture_setup()

        for _ in range(5):
            CategoryFactory()
Пример #11
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")

        CategoryFactory(name='Security', product=f_product)
        CategoryFactory(name='Sanity', product=f_product)
        f_category = CategoryFactory(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 = [TagFactory() 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, BugSystem.objects.first().pk)