Beispiel #1
0
    def setUpTestData(cls):
        cls.author = f.UserFactory(username='******', email='*****@*****.**')
        cls.http_req = make_http_request(user=cls.author)

        cls.product = f.ProductFactory()
        cls.version = f.VersionFactory(product=cls.product)
        cls.type = f.TestPlanTypeFactory(name='temp')
        cls.tag_fedora = f.TestTagFactory(name='fedora')
        cls.tag_centos = f.TestTagFactory(name='centos')

        cls.plan = f.TestPlanFactory(is_active=True,
                                     extra_link=None,
                                     product=cls.product,
                                     product_version=cls.version,
                                     owner=cls.author,
                                     author=cls.author,
                                     parent=None,
                                     type=cls.type,
                                     tag=[cls.tag_fedora, cls.tag_centos])
Beispiel #2
0
    def setUpTestData(cls):
        cls.user = f.UserFactory()
        cls.http_req = make_http_request(user=cls.user,
                                         user_perm='testplans.change_testplan')

        cls.env_group_1 = f.TCMSEnvGroupFactory()
        cls.env_group_2 = f.TCMSEnvGroupFactory()
        cls.product = f.ProductFactory()
        cls.version = f.VersionFactory(product=cls.product)
        cls.tester = f.UserFactory()
        cls.plan_type = f.TestPlanTypeFactory(name='manual smoking')
        cls.plan_1 = f.TestPlanFactory(product_version=cls.version,
                                       product=cls.product,
                                       author=cls.tester,
                                       type=cls.plan_type,
                                       env_group=(cls.env_group_1, ))
        cls.plan_2 = f.TestPlanFactory(product_version=cls.version,
                                       product=cls.product,
                                       author=cls.tester,
                                       type=cls.plan_type,
                                       env_group=(cls.env_group_1, ))
Beispiel #3
0
 def setUpTestData(cls):
     cls.product = f.ProductFactory()
     cls.version = f.VersionFactory(product=cls.product)
     cls.tester = f.UserFactory()
     cls.plan_type = f.TestPlanTypeFactory(name='manual smoking')
     cls.plan_1 = f.TestPlanFactory(product_version=cls.version,
                                    product=cls.product,
                                    author=cls.tester,
                                    type=cls.plan_type)
     cls.plan_2 = f.TestPlanFactory(product_version=cls.version,
                                    product=cls.product,
                                    author=cls.tester,
                                    type=cls.plan_type)
     cls.case_1 = f.TestCaseFactory(author=cls.tester,
                                    default_tester=None,
                                    reviewer=cls.tester,
                                    plan=[cls.plan_1])
     cls.case_2 = f.TestCaseFactory(author=cls.tester,
                                    default_tester=None,
                                    reviewer=cls.tester,
                                    plan=[cls.plan_1])
Beispiel #4
0
    def setUpTestData(cls):
        cls.user = f.UserFactory(username='******', email='*****@*****.**')
        cls.user.set_password('admin')
        cls.user.is_superuser = True
        cls.user.save()

        cls.c = Client()
        cls.c.login(username='******', password='******')

        cls.classification = f.ClassificationFactory(name='Auto')
        cls.product = f.ProductFactory(name='Nitrate',
                                       classification=cls.classification)
        cls.product_version = f.VersionFactory(value='0.1',
                                               product=cls.product)
        cls.plan_type = f.TestPlanTypeFactory()

        cls.test_plan = f.TestPlanFactory(name='another test plan for testing',
                                          product_version=cls.product_version,
                                          owner=cls.user,
                                          author=cls.user,
                                          product=cls.product,
                                          type=cls.plan_type)
        cls.plan_id = cls.test_plan.pk
Beispiel #5
0
    def test_product_delete_with_test_plan_wo_email_settings(self):
        """
            A test to demonstrate Issue #181.

            Steps to reproduce:
            1) Create a new Product
            2) Create a new Test Plan for Product
            3) DON'T edit the Test Plan
            4) Delete the Product

            Expected results:
            0) No errors
            1) Product is deleted
            2) Test Plan is deleted

            NOTE: we manually connect signals handlers here
            b/c in est mode LISTENING_MODEL_SIGNAL = False
        """
        # setup
        product = f.ProductFactory(name='Something to delete')
        product_version = f.VersionFactory(value='0.1', product=product)
        plan_type = f.TestPlanTypeFactory()

        # create Test Plan via the UI by sending a POST request to the view
        previous_plans_count = TestPlan.objects.count()
        test_plan_name = 'Test plan for the new product'
        response = self.c.post(reverse('plans-new'), {
            'name': test_plan_name,
            'product': product.pk,
            'product_version': product_version.pk,
            'type': plan_type.pk,
        }, follow=True)
        self.assert200(response)
        # verify test plan was created
        self.assertContains(response, test_plan_name)
        self.assertEqual(previous_plans_count + 1, TestPlan.objects.count())

        the_new_plan = list(TestPlan.objects.order_by('pk'))[-1]

        # now delete the product
        admin_delete_url = "admin:{}_{}_delete".format(product._meta.app_label,
                                                       product._meta.model_name)
        location = reverse(admin_delete_url, args=[product.pk])
        response = self.c.get(location)
        self.assert200(response)
        self.assertContains(
            response,
            'Are you sure you want to delete the product "%s"' % product.name)
        self.assertContains(response, "Yes, I'm sure")

        # confirm that we're sure we want to delete it
        response = self.c.post(location, {'post': 'yes'})
        self.assert302(response)
        self.assertIn(
            '/admin/{}/{}/'.format(product._meta.app_label,
                                   product._meta.model_name),
            response['Location'])

        # verify everything has been deleted
        self.assertFalse(Product.objects.filter(pk=product.pk).exists())
        self.assertFalse(Version.objects.filter(pk=product_version.pk).exists())
        self.assertEqual(previous_plans_count, TestPlan.objects.count())
        from tcms.testplans.models import TestPlanEmailSettings
        self.assertFalse(
            TestPlanEmailSettings.objects.filter(plan=the_new_plan).exists())
Beispiel #6
0
 def setUpTestData(cls):
     cls.http_req = make_http_request()
     cls.plan_type = f.TestPlanTypeFactory(name='xmlrpc plan type',
                                           description='')