Esempio n. 1
0
 def setUpTestData(cls):
     cls.user = f.UserFactory(username='******')
     cls.product_starcraft = f.ProductFactory(name='StarCraft')
     cls.starcraft_version_0_1 = f.VersionFactory(
         value='0.1', product=cls.product_starcraft)
     cls.starcraft_version_0_2 = f.VersionFactory(
         value='0.2', product=cls.product_starcraft)
     cls.product_streetfighter = f.ProductFactory(name='StreetFighter')
     cls.streetfighter_version_0_1 = f.VersionFactory(
         value='0.1', product=cls.product_streetfighter)
     cls.plans = [
         f.TestPlanFactory(name='StarCraft: Init',
                           product=cls.product_starcraft,
                           product_version=cls.starcraft_version_0_1,
                           author=cls.user,
                           owner=cls.user),
         f.TestPlanFactory(name='StarCraft: Start',
                           product=cls.product_starcraft,
                           product_version=cls.starcraft_version_0_2,
                           author=cls.user,
                           owner=cls.user),
         f.TestPlanFactory(name='StreetFighter',
                           product=cls.product_streetfighter,
                           product_version=cls.streetfighter_version_0_1,
                           author=cls.user,
                           owner=cls.user),
     ]
Esempio n. 2
0
 def setUpTestData(cls):
     cls.product_nitrate = f.ProductFactory(name='nitrate')
     cls.product_xmlrpc = f.ProductFactory(name='xmlrpc')
     cls.components = [
         f.ComponentFactory(name='application', product=cls.product_nitrate),
         f.ComponentFactory(name='database', product=cls.product_nitrate),
         f.ComponentFactory(name='documentation', product=cls.product_xmlrpc),
     ]
Esempio n. 3
0
 def test_unpublished_method_returns_draft_and_unpublished(self):
     published = factories.ProductFactory(status=Product.PUBLISHED_LIVE)
     draft = factories.ProductFactory(status=Product.PUBLISHED_DRAFT)
     unpublished = factories.ProductFactory(
         status=Product.PUBLISHED_UNPUBLISHED)
     result = Product.objects.unpublished()
     self.assertEqual(len(result), 2)
     self.assertEqual(set(result), set([draft, unpublished]))
Esempio n. 4
0
 def setUpTestData(cls):
     cls.product_nitrate = f.ProductFactory(name='nitrate')
     cls.product_xmlrpc = f.ProductFactory(name='xmlrpc')
     cls.case_categories = [
         f.TestCaseCategoryFactory(name='auto', product=cls.product_nitrate),
         f.TestCaseCategoryFactory(name='manual', product=cls.product_nitrate),
         f.TestCaseCategoryFactory(name='pending', product=cls.product_xmlrpc),
     ]
Esempio n. 5
0
    def setUpTestData(cls):
        cls.admin = f.UserFactory()
        cls.admin_request = make_http_request(
            user=cls.admin, user_perm='management.change_testbuild')

        cls.staff = f.UserFactory()
        cls.staff_request = make_http_request(user=cls.staff)

        cls.product = f.ProductFactory()
        cls.another_product = f.ProductFactory()

        cls.build_1 = f.TestBuildFactory(product=cls.product)
        cls.build_2 = f.TestBuildFactory(product=cls.product)
        cls.build_3 = f.TestBuildFactory(product=cls.product)
Esempio n. 6
0
    def setUpTestData(cls):
        cls.http_req = make_http_request()

        cls.tester = f.UserFactory(username='******')
        cls.reviewer = f.UserFactory(username='******')
        cls.product = f.ProductFactory()
        cls.plan = f.TestPlanFactory(author=cls.tester,
                                     owner=cls.tester,
                                     product=cls.product)
        cls.cases = [
            f.TestCaseFactory(author=cls.tester,
                              default_tester=None,
                              reviewer=cls.reviewer,
                              plan=[cls.plan]),
            f.TestCaseFactory(author=cls.tester,
                              default_tester=None,
                              reviewer=cls.reviewer,
                              plan=[cls.plan]),
            f.TestCaseFactory(author=cls.tester,
                              default_tester=None,
                              reviewer=cls.reviewer,
                              plan=[cls.plan]),
        ]
        cls.another_plan = f.TestPlanFactory(author=cls.tester,
                                             owner=cls.tester,
                                             product=cls.product)
Esempio n. 7
0
    def setUpTestData(cls):
        cls.user = f.UserFactory()
        cls.http_req = make_http_request(user=cls.user)

        cls.product = f.ProductFactory()
        cls.version = f.VersionFactory(product=cls.product)
        cls.build = f.TestBuildFactory(product=cls.product)
        cls.plan = f.TestPlanFactory(
            product=cls.product,
            product_version=cls.version,
        )
        cls.plan_manager = f.UserFactory()
        cls.plan_default_tester = f.UserFactory()
        cls.tag_fedora = f.TestTagFactory(name='fedora')
        cls.tag_python = f.TestTagFactory(name='automation')
        cls.test_run = f.TestRunFactory(
            plan_text_version=1,
            notes='Running tests ...',
            product_version=cls.version,
            build=cls.build,
            plan=cls.plan,
            manager=cls.plan_manager,
            default_tester=cls.plan_default_tester,
            tag=[cls.tag_fedora, cls.tag_python]
        )
Esempio n. 8
0
    def setUpTestData(cls):
        cls.user = f.UserFactory()
        cls.http_req = make_http_request(
            user=cls.user, user_perm='testplans.add_testplancomponent')

        cls.product = f.ProductFactory()
        cls.plans = [
            f.TestPlanFactory(author=cls.user,
                              owner=cls.user,
                              product=cls.product),
            f.TestPlanFactory(author=cls.user,
                              owner=cls.user,
                              product=cls.product),
        ]
        cls.component1 = f.ComponentFactory(
            name='xmlrpc test component 1',
            description='xmlrpc test description',
            product=cls.product,
            initial_owner=None,
            initial_qa_contact=None)
        cls.component2 = f.ComponentFactory(
            name='xmlrpc test component 2',
            description='xmlrpc test description',
            product=cls.product,
            initial_owner=None,
            initial_qa_contact=None)
Esempio n. 9
0
    def test_get_quantity(self):
        self.cart.add(self.product)
        self.cart.add(self.product)
        self.assertEqual(self.cart.get_quantity(self.product), 2)

        other_product = factories.ProductFactory()
        self.assertEqual(self.cart.get_quantity(other_product), 0)
Esempio n. 10
0
 def setUpTestData(cls):
     cls.product = f.ProductFactory(name='StarCraft')
     cls.builds_count = 3
     cls.builds = [
         f.TestBuildFactory(product=cls.product)
         for i in range(cls.builds_count)
     ]
Esempio n. 11
0
 def setUpTestData(cls):
     cls.product = f.ProductFactory(name='StarCraft')
     cls.component = f.ComponentFactory(
         name='application',
         product=cls.product,
         initial_owner=None,
         initial_qa_contact=None)
Esempio n. 12
0
 def setUpTestData(cls):
     cls.http_req = make_http_request()
     cls.user = f.UserFactory()
     cls.product = f.ProductFactory()
     cls.plan = f.TestPlanFactory(author=cls.user,
                                  owner=cls.user,
                                  product=cls.product)
Esempio n. 13
0
    def setUpTestData(cls):
        super().setUpTestData()

        cls.case_status_confirmed = TestCaseStatus.objects.get(name='CONFIRMED')
        cls.case_status_proposed = TestCaseStatus.objects.get(name='PROPOSED')

        cls.product = f.ProductFactory(name='Nitrate')
        cls.version = f.VersionFactory(value='0.1', product=cls.product)

        cls.plan = f.TestPlanFactory(
            author=cls.tester,
            owner=cls.tester,
            product=cls.product,
            product_version=cls.version)

        case_creator = partial(
            f.TestCaseFactory,
            author=cls.tester,
            default_tester=None,
            reviewer=cls.tester,
            case_status=cls.case_status_confirmed,
            plan=[cls.plan])

        cls.case = case_creator(summary='Test case 0')
        cls.case_1 = case_creator(summary='Test case 1')
        cls.case_2 = case_creator(summary='Test case 2')
        cls.case_3 = case_creator(summary='Test case 3')
        cls.case_4 = case_creator(summary='Test case 4')
        cls.case_5 = case_creator(summary='Test case 5')
        cls.case_6 = case_creator(summary='Test case 6')
Esempio n. 14
0
    def setUpTestData(cls):
        cls.author = f.UserFactory(username='******', email='*****@*****.**')
        cls.http_req = make_http_request(user=cls.author,
                                         user_perm='testplans.add_testplan')

        cls.product = f.ProductFactory()
        cls.version = f.VersionFactory(product=cls.product)
        cls.type = TestPlanType.objects.first()
Esempio n. 15
0
 def setUpTestData(cls):
     cls.product = f.ProductFactory(name='Nitrate')
     cls.build = f.TestBuildFactory(product=cls.product)
     cls.user = f.UserFactory()
     cls.case_run_1 = f.TestCaseRunFactory(assignee=cls.user,
                                           build=cls.build)
     cls.case_run_2 = f.TestCaseRunFactory(assignee=cls.user,
                                           build=cls.build)
Esempio n. 16
0
 def setUpTestData(cls):
     cls.product = f.ProductFactory()
     cls.version = f.VersionFactory(value='0.1', product=cls.product)
     cls.build = f.TestBuildFactory(product=cls.product)
     cls.user = f.UserFactory()
     cls.test_run = f.TestRunFactory(manager=cls.user,
                                     default_tester=None,
                                     build=cls.build)
Esempio n. 17
0
    def setUpTestData(cls):
        cls.admin = f.UserFactory()
        cls.admin_request = make_http_request(
            user=cls.admin, user_perm='management.add_testbuild')

        cls.staff = f.UserFactory()
        cls.staff_request = make_http_request(user=cls.staff)

        cls.product = f.ProductFactory(name='Nitrate')
Esempio n. 18
0
    def setUp(self):
        super(OrderTestCase, self).setUp()
        self.stall = factories.StallFactory()
        self.order = factories.OrderFactory(stall=self.stall)

        self.product1 = factories.ProductFactory(stall=self.stall)
        self.product2 = factories.ProductFactory(stall=self.stall)

        self.line_item2 = factories.LineItemFactory(product=self.product1,
                                                    quantity=10,
                                                    order=self.order,
                                                    price=10)
        self.line_item2 = factories.LineItemFactory(product=self.product2,
                                                    quantity=10,
                                                    order=self.order,
                                                    price=20)
        self.order.delivery_charge = Money(10)
        self.order.save()
Esempio n. 19
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.product = f.ProductFactory()
     cls.product_version = f.VersionFactory(value='1.0',
                                            product=cls.product)
     cls.plan = f.TestPlanFactory(product=cls.product,
                                  product_version=cls.product_version)
     cls.parent = f.TestPlanFactory(product=cls.product,
                                    product_version=cls.product_version)
Esempio n. 20
0
    def setUpTestData(cls):
        cls.product_name = 'StarCraft'
        cls.versions = ['0.6', '0.7', '0.8', '0.9', '1.0']

        cls.product = f.ProductFactory(name=cls.product_name)
        cls.product_versions = [
            f.VersionFactory(product=cls.product, value=version)
            for version in cls.versions
        ]
Esempio n. 21
0
 def setUpTestData(cls):
     cls.product_name = 'StarCraft'
     cls.product = f.ProductFactory(name=cls.product_name)
     cls.admin = f.UserFactory(
         username='******', email='*****@*****.**')
     cls.staff = f.UserFactory(
         username='******', email='*****@*****.**')
     cls.admin_request = make_http_request(user=cls.admin, user_perm='management.add_version')
     cls.staff_request = make_http_request(user=cls.staff)
Esempio n. 22
0
def test_get_product_by_id_returns_none_if_no_match():
    # arrange
    fake_products = [factories.ProductFactory() for _ in range(10)]
    store.product_records = fake_products

    # act
    product = store.get_product_by_id('I do not exist')

    # assert
    assert product is None
Esempio n. 23
0
def test_get_product_by_id():
    # arrange
    fake_products = [factories.ProductFactory() for _ in range(10)]
    store.product_records = fake_products

    # act
    product = store.get_product_by_id(fake_products[5]['id'])

    # assert
    assert product == fake_products[5]
Esempio n. 24
0
def test_get_product_by_id_only_gets_desired(flask_app):
    # arrange
    products = [factories.ProductFactory() for _ in range(10)]
    store.product_records = products

    # act
    received_product = flask_app.test_client().get(
        f'/api/products/{products[6]["id"]}')

    # assert
    assert products[6] == json.loads(received_product.data)
Esempio n. 25
0
def test_get_products_pagination_does_not_error_if_page_bigger_than_dataset():
    # arrange
    fake_products = [factories.ProductFactory() for _ in range(5)]
    store.product_records = fake_products

    # act
    products, total_records = store.get_products(page=1, page_size=10)

    # assert
    assert total_records == 5
    assert products == fake_products
Esempio n. 26
0
def test_get_product_by_id(flask_app):
    # arrange
    product_id = 'product_1'
    product = factories.ProductFactory(id=product_id)
    store.product_records = [product]

    # act
    received_product = flask_app.test_client().get(
        f'/api/products/{product_id}')

    # assert
    assert product == json.loads(received_product.data)
Esempio n. 27
0
 def setUp(self):
     super(CartProductsViewPostTestCase, self).setUp()
     self.cart_stall = factories.create_cart_stall(1)
     product1 = self.cart_stall.cart_products.all()[0].product
     self.product = factories.ProductFactory(
         stall=self.cart_stall.stall,
         shipping_profile=product1.shipping_profile)
     self.cart = self.cart_stall.cart
     self.view_url = reverse('cart_products',
                             kwargs={"cart_id": self.cart.id})
     self.client.login(username=self.cart.user.username,
                       password="******")
Esempio n. 28
0
    def setUpTestData(cls):
        cls.admin = f.UserFactory()
        cls.staff = f.UserFactory()
        cls.initial_owner = f.UserFactory()
        cls.initial_qa_contact = f.UserFactory()

        cls.admin_request = make_http_request(user=cls.admin, user_perm='management.add_component')
        cls.staff_request = make_http_request(user=cls.staff)
        cls.product = f.ProductFactory()

        # Any added component in tests will be added to this list and then remove them all
        cls.components_to_delete = []
Esempio n. 29
0
 def setUpTestData(cls):
     cls.product = f.ProductFactory(name='StarCraft')
     cls.starcraft_version_0_1 = f.VersionFactory(
         value='0.1', product=cls.product)
     cls.components = [
         f.ComponentFactory(name='application', product=cls.product,
                            initial_owner=None, initial_qa_contact=None),
         f.ComponentFactory(name='database', product=cls.product,
                            initial_owner=None, initial_qa_contact=None),
         f.ComponentFactory(name='documentation', product=cls.product,
                            initial_owner=None, initial_qa_contact=None),
     ]
Esempio n. 30
0
 def setUp(self):
     self.product = factories.ProductFactory(
         title="My Product title",
         description="My product description",
         stall__identifier="12345678",
     )
     self.price = factories.PriceFactory(product=self.product, amount=10)
     self.category_mapper = mock.Mock()
     self.category_mapper.get_category.return_value = \
         "some category > some child category"
     self.builder = self.FEED_BUILDER_CLASS(self.product,
                                            self.category_mapper)