Beispiel #1
0
    def test_get_mail_templates(self):
        templates = self.__mail_service.get_mail_templates()
        assert_that(templates, has_length(greater_than(0)))

        templates = \
            self.__mail_service.get_mail_templates(
                types=frozenset((MailTemplateType(TemplateType.BASE),))
            )
        assert_that(templates, has_length(greater_than(0)))
Beispiel #2
0
    def test_get_mail_templates(self):
        templates = self.__mail_service.get_mail_templates()
        assert_that(templates, has_length(greater_than(0)))

        templates = \
            self.__mail_service.get_mail_templates(
                types=frozenset((MailTemplateType(TemplateType.BASE),))
            )
        assert_that(templates, has_length(greater_than(0)))
    def test_get_products_query(self):
        if self.__catalog_service is None:
            return

        if self.__read_only:
            products = self.__catalog_service.get_products(query='dvd')
            assert_that(products, has_length(greater_than(0)))
        else:
            self.__put_products()
            products = self.__catalog_service.get_products(query='1')
            assert_that(products, has_length(1))
 def runTest(self):
     iprot = MagentoXmlrpcProtocol(self.PRODUCTS_XMLRPC)
     products = []
     for _ in xrange(iprot.readListBegin()[1]):
         product = MagentoProduct.read(iprot)
         assert product is not None
         products.append(product)
     iprot.readListEnd()
     assert_that(products, has_length(1))
    def test_delete_products(self):
        if self.__catalog_service is None or self.__read_only:
            return

        self.__put_products()

        products = self.__catalog_service.get_products()
        assert_that(products, equal_to(self.__products))

        self.__catalog_service.delete_products()
        products = self.__catalog_service.get_products()
        assert_that(products, has_length(0))
    def test_head_product_by_sku(self):
        if self.__catalog_service is None:
            return

        if not self.__read_only:
            self.__put_products()

        product_skus = self.__catalog_service.get_product_skus()
        assert_that(product_skus, has_length(greater_than(0)))
        for product_sku in product_skus:
            head = self.__catalog_service.head_product_by_sku(product_sku)
            assert_that(head, instance_of(bool))
            self.assertTrue(head)
        self.assertFalse(self.__catalog_service.head_product_by_sku('nonextantsku'))
    def test_get_product_skus(self):
        if self.__catalog_service is None:
            return

        if not self.__read_only:
            self.__put_products()

        product_skus = self.__catalog_service.get_product_skus()
        assert_that(product_skus, has_length(greater_than(0)))
        for product_sku in product_skus:
            assert_that(product_sku, instance_of(basestring))

        if not self.__read_only:
            assert_that(product_skus, equal_to(self.__product_skus))
    def test_get_product_by_sku(self):
        if self.__catalog_service is None:
            return

        if not self.__read_only:
            self.__put_products()

        product_skus = self.__catalog_service.get_product_skus()
        assert_that(product_skus, has_length(greater_than(0)))
        for product_sku in product_skus:
            product = self.__catalog_service.get_product_by_sku(product_sku)
            assert_that(product, instance_of(Product))

        try:
            self.__catalog_service.get_product_by_sku('nonexitantsku')
            self.fail()
        except NoSuchProductException:
            pass
    def test_get_products_include_disabled(self):
        if self.__catalog_service is None:
            return

        if self.__read_only:
            products = self.__catalog_service.get_products(include_disabled=True)
            assert_that(products, has_length(greater_than(0)))
        else:
            self.__put_products()

            disabled_product = list(self.__products)[0]
            disabled_product = disabled_product.replace(magento_product=disabled_product.magento_product.replace(sku='Test product disabled').replace(status=MagentoProductStatus.DISABLED))
            self.__catalog_service.put_product(disabled_product)

            products = self.__catalog_service.get_products(include_disabled=True)
            assert_that(products, equal_to(frozenset(list(self.__products) + [disabled_product])))

            enabled_products = self.__catalog_service.get_products(include_disabled=False)
            assert_that(enabled_products, equal_to(self.__products))
Beispiel #10
0
 def test_get_mail_template_info(self):
     templates = self.__mail_service.get_mail_templates()
     assert_that(templates, has_length(greater_than(0)))
     for template in templates:
         self.__mail_service.get_mail_template_info(template.mail_chimp_template.id)
 def testDoesNotMatchObjectWithoutLen(self):
     self.assert_does_not_match("no length", has_length(42), object())
Beispiel #12
0
 def test_get_mail_lists(self):
     lists = self.__mail_service.get_mail_lists()
     assert_that(lists, has_length(greater_than(0)))
 def testSuccessfulMatchDoesNotGenerateMismatchDescription(self):
     self.assert_no_mismatch_description(has_length(3), "foo")
Beispiel #14
0
 def test_get_mail_lists(self):
     lists = self.__mail_service.get_mail_lists()
     assert_that(lists, has_length(greater_than(0)))
 def testDescribeMismatchForItemWithoutLength(self):
     self.assert_describe_mismatch("was <FakeWithoutLen>", has_length(3),
                                   FakeWithoutLen())
 def testDescribeMismatchForItemWithWrongLength(self):
     self.assert_describe_mismatch("was <FakeWithLen> with length of <4>",
                                   has_length(3), FakeWithLen(4))
 def testMismatchDescriptionForItemWithoutLength(self):
     self.assert_mismatch_description("was <FakeWithoutLen>", has_length(3),
                                      FakeWithoutLen())
 def testMismatchDescriptionForItemWithWrongLength(self):
     self.assert_mismatch_description(
         "was <FakeWithLen> with length of <4>", has_length(3),
         FakeWithLen(4))
Beispiel #19
0
 def test_has_length_matcher(self):
     list = [10, 20, 30]
     when(self.spy.one_arg_method).with_args(
         has_length(3)).then_return(1000)
     self.assertEqual(1000, self.spy.one_arg_method(list))
Beispiel #20
0
 def test_get_mail_template_info(self):
     templates = self.__mail_service.get_mail_templates()
     assert_that(templates, has_length(greater_than(0)))
     for template in templates:
         self.__mail_service.get_mail_template_info(
             template.mail_chimp_template.id)
 def testProvidesConvenientShortcutForHasLengthEqualTo(self):
     self.assert_matches("equal", has_length(42), FakeWithLen(42))
     self.assert_does_not_match("unequal", has_length(42), FakeWithLen(1))
 def testHasReadableDescription(self):
     self.assert_description(
         "an object with length of a value greater than <5>",
         has_length(greater_than(5)))
 def test_has_length_matcher(self):
     list = [10, 20, 30]
     when(self.spy.one_arg_method).with_args(
         has_length(3)).then_return(1000)
     self.assertEqual(1000, self.spy.one_arg_method(list))
 def testPassesResultOfLenToNestedMatcher(self):
     self.assert_matches("equal", has_length(equal_to(42)), FakeWithLen(42))
     self.assert_does_not_match("unequal", has_length(equal_to(42)),
                                FakeWithLen(1))