本文整理汇总了Python中satchmo.caching.cache_delete函数的典型用法代码示例。如果您正苦于以下问题:Python cache_delete函数的具体用法?Python cache_delete怎么用?Python cache_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cache_delete函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
caching.cache_delete()
wide = config_register(
LongStringValue(SHOP_GROUP, "LONG", ordering=1, default="woot")
)
self.wide = wide
self.wide.update("*" * 1000)
开发者ID:ToeKnee,项目名称:jelly-roll,代码行数:7,代码来源:tests.py
示例2: testDuplicateAdminAreas
def testDuplicateAdminAreas(self):
"""Test the situation where we have multiple adminareas with the same name"""
cache_delete()
tax = config_get('TAX', 'MODULE')
tax.update('satchmo.tax.modules.area')
order = make_test_order('GB', 'Manchester')
order.recalculate_total(save=False)
price = order.total
subtotal = order.sub_total
tax = order.tax
self.assertEqual(subtotal, Decimal('100.00'))
self.assertEqual(tax, Decimal('20.00'))
# 100 + 10 shipping + 20 tax
self.assertEqual(price, Decimal('130.00'))
taxes = order.taxes.all()
self.assertEqual(2, len(taxes))
t1 = taxes[0]
t2 = taxes[1]
self.assert_('Shipping' in (t1.description, t2.description))
if t1.description == 'Shipping':
tship = t1
tmain = t2
else:
tship = t2
tmain = t1
self.assertEqual(tmain.tax, Decimal('20.00'))
self.assertEqual(tship.tax, Decimal('0.00'))
开发者ID:juderino,项目名称:jelly-roll,代码行数:31,代码来源:tests.py
示例3: testDuplicateAdminAreas
def testDuplicateAdminAreas(self):
"""Test the situation where we have multiple adminareas with the same name"""
cache_delete()
tax = config_get("TAX", "MODULE")
tax.update("satchmo.tax.modules.area")
order = make_test_order("GB", "Manchester")
order.recalculate_total(save=False)
price = order.total
subtotal = order.sub_total
tax = order.tax
self.assertEqual(subtotal, Decimal("100.00"))
self.assertEqual(tax, Decimal("20.00"))
# 100 + 10 shipping + 20 tax
self.assertEqual(price, Decimal("130.00"))
taxes = order.taxes.all()
self.assertEqual(2, len(taxes))
t1 = taxes[0]
t2 = taxes[1]
self.assertTrue("Shipping" in (t1.description, t2.description))
if t1.description == "Shipping":
tship = t1
tmain = t2
else:
tship = t2
tmain = t1
self.assertEqual(tmain.tax, Decimal("20.00"))
self.assertEqual(tship.tax, Decimal("0.00"))
开发者ID:ToeKnee,项目名称:jelly-roll,代码行数:31,代码来源:tests.py
示例4: setUp
def setUp(self):
# clear out cache from previous runs
caching.cache_delete()
g1 = ConfigurationGroup('req2', 'Requirements 2', ordering=1000)
self.g1 = g1
choices1 = config_register(MultipleStringValue(SHOP_GROUP, 'rc1', ordering=1))
self.g1c1 = config_register(IntegerValue(g1, 'c1', requires=choices1, ordering=3))
self.g1c2 = config_register(IntegerValue(g1, 'c2', requires=choices1, ordering=4))
self.g1c3 = config_register(IntegerValue(g1, 'c3', ordering=5))
choices1.update('c1')
g2 = ConfigurationGroup('req3', 'Requirements 3', ordering=1000)
self.g2 = g2
choices2 = config_register(StringValue(SHOP_GROUP, 'choices2', ordering=1))
self.g2c1 = config_register(IntegerValue(g2, 'c1', requires=choices2, ordering=3))
self.g2c2 = config_register(IntegerValue(g2, 'c2', requires=choices2, ordering=4))
self.g2c3 = config_register(IntegerValue(g2, 'c3', requires=choices2, ordering=5))
choices2.update('c1')
开发者ID:davemerwin,项目名称:satchmo,代码行数:27,代码来源:tests.py
示例5: testPercent
def testPercent(self):
"""Test percent tax without shipping"""
cache_delete()
tax = config_get("TAX", "MODULE")
tax.update("satchmo.tax.modules.percent")
pcnt = config_get("TAX", "PERCENT")
pcnt.update("10")
shp = config_get("TAX", "TAX_SHIPPING")
shp.update(False)
order = make_test_order("US", "TX")
order.recalculate_total(save=False)
price = order.total
subtotal = order.sub_total
tax = order.tax
self.assertEqual(subtotal, Decimal("100.00"))
self.assertEqual(tax, Decimal("10.00"))
# 100 + 10 shipping + 10 tax
self.assertEqual(price, Decimal("120.00"))
taxes = order.taxes.all()
self.assertEqual(1, len(taxes))
self.assertEqual(taxes[0].tax, Decimal("10.00"))
self.assertEqual(taxes[0].description, r"10%")
开发者ID:ToeKnee,项目名称:jelly-roll,代码行数:26,代码来源:tests.py
示例6: setUp
def setUp(self):
# clear out cache from previous runs
caching.cache_delete()
g1 = ConfigurationGroup("reqval", "Requirements 3", ordering=1000)
self.g1 = g1
choices1 = config_register(MultipleStringValue(SHOP_GROUP, "valchoices", ordering=1))
self.g1c1 = config_register(IntegerValue(g1, "c1", requires=choices1, requiresvalue="foo", ordering=3))
self.g1c2 = config_register(IntegerValue(g1, "c2", requires=choices1, requiresvalue="bar", ordering=4))
self.g1c3 = config_register(IntegerValue(g1, "c3", ordering=5))
choices1.update("foo")
g2 = ConfigurationGroup("reqval2", "Requirements 4", ordering=1000)
self.g2 = g2
choices2 = config_register(
StringValue(
SHOP_GROUP, "valchoices2", ordering=1, choices=(("a", "test a"), ("b", "test b"), ("c", "test c"))
)
)
self.g2c1 = config_register(IntegerValue(g2, "c1", requires=choices2, requiresvalue="a", ordering=3))
self.g2c2 = config_register(IntegerValue(g2, "c2", requires=choices2, requiresvalue="b", ordering=4))
self.g2c3 = config_register(IntegerValue(g2, "c3", requires=choices2, requiresvalue="c", ordering=5))
choices2.update("a")
开发者ID:sankroh,项目名称:satchmo,代码行数:31,代码来源:tests.py
示例7: testAreaCountries
def testAreaCountries(self):
"""Test Area tax module"""
cache_delete()
tax = config_get("TAX", "MODULE")
tax.update("satchmo.tax.modules.area")
order = make_test_order("DE", "", include_non_taxed=True)
order.recalculate_total(save=False)
price = order.total
subtotal = order.sub_total
tax = order.tax
self.assertEqual(subtotal, Decimal("105.00"))
self.assertEqual(tax, Decimal("20.00"))
# 100 + 10 shipping + 20 tax
self.assertEqual(price, Decimal("135.00"))
taxes = order.taxes.all()
self.assertEqual(2, len(taxes))
t1 = taxes[0]
t2 = taxes[1]
self.assertTrue("Shipping" in (t1.description, t2.description))
if t1.description == "Shipping":
tship = t1
tmain = t2
else:
tship = t2
tmain = t1
self.assertEqual(tmain.tax, Decimal("20.00"))
self.assertEqual(tship.tax, Decimal("0.00"))
order = make_test_order("CH", "")
order.recalculate_total(save=False)
price = order.total
subtotal = order.sub_total
tax = order.tax
self.assertEqual(subtotal, Decimal("100.00"))
self.assertEqual(tax, Decimal("16.00"))
# 100 + 10 shipping + 16 tax
self.assertEqual(price, Decimal("126.00"))
taxes = order.taxes.all()
self.assertEqual(2, len(taxes))
t1 = taxes[0]
t2 = taxes[1]
self.assertTrue("Shipping" in (t1.description, t2.description))
if t1.description == "Shipping":
tship = t1
tmain = t2
else:
tship = t2
tmain = t1
self.assertEqual(tmain.tax, Decimal("16.00"))
self.assertEqual(tship.tax, Decimal("0.00"))
开发者ID:ToeKnee,项目名称:jelly-roll,代码行数:58,代码来源:tests.py
示例8: testAreaCountries
def testAreaCountries(self):
"""Test Area tax module"""
cache_delete()
tax = config_get('TAX', 'MODULE')
tax.update('satchmo.tax.modules.area')
order = make_test_order('DE', '', include_non_taxed=True)
order.recalculate_total(save=False)
price = order.total
subtotal = order.sub_total
tax = order.tax
self.assertEqual(subtotal, Decimal('105.00'))
self.assertEqual(tax, Decimal('20.00'))
# 100 + 10 shipping + 20 tax
self.assertEqual(price, Decimal('135.00'))
taxes = order.taxes.all()
self.assertEqual(2, len(taxes))
t1 = taxes[0]
t2 = taxes[1]
self.assert_('Shipping' in (t1.description, t2.description))
if t1.description == 'Shipping':
tship = t1
tmain = t2
else:
tship = t2
tmain = t1
self.assertEqual(tmain.tax, Decimal('20.00'))
self.assertEqual(tship.tax, Decimal('0.00'))
order = make_test_order('CH', '')
order.recalculate_total(save=False)
price = order.total
subtotal = order.sub_total
tax = order.tax
self.assertEqual(subtotal, Decimal('100.00'))
self.assertEqual(tax, Decimal('16.00'))
# 100 + 10 shipping + 16 tax
self.assertEqual(price, Decimal('126.00'))
taxes = order.taxes.all()
self.assertEqual(2, len(taxes))
t1 = taxes[0]
t2 = taxes[1]
self.assert_('Shipping' in (t1.description, t2.description))
if t1.description == 'Shipping':
tship = t1
tmain = t2
else:
tship = t2
tmain = t1
self.assertEqual(tmain.tax, Decimal('16.00'))
self.assertEqual(tship.tax, Decimal('0.00'))
开发者ID:juderino,项目名称:jelly-roll,代码行数:58,代码来源:tests.py
示例9: testOrderSuccess
def testOrderSuccess(self):
"""Test cert creation on order success"""
cache_delete()
order = make_test_order("US", "")
order.order_success()
certs = order.giftcertificates.all()
self.assertEqual(len(certs), 1)
c = certs[0]
self.assertEqual(c.balance, Decimal("20.00"))
self.assertEqual(c.recipient_email, "[email protected]")
self.assertEqual(c.message, "hello there")
开发者ID:ToeKnee,项目名称:jelly-roll,代码行数:12,代码来源:tests.py
示例10: test_checkout
def test_checkout(self):
"""
Run through a full checkout process
"""
cache_delete()
tax = config_get("TAX", "MODULE")
tax.update("satchmo.tax.modules.percent")
pcnt = config_get("TAX", "PERCENT")
pcnt.update("10")
shp = config_get("TAX", "TAX_SHIPPING")
shp.update(False)
self.test_cart_adding()
response = self.client.post(url("satchmo_checkout-step1"), get_step1_post_data(self.US))
self.assertRedirects(response, url("DUMMY_satchmo_checkout-step2"), status_code=302, target_status_code=200)
data = {
"credit_type": "Visa",
"credit_number": "4485079141095836",
"month_expires": "1",
"year_expires": "2009",
"ccv": "552",
"shipping": "FlatRate",
}
response = self.client.post(url("DUMMY_satchmo_checkout-step2"), data)
self.assertRedirects(response, url("DUMMY_satchmo_checkout-step3"), status_code=302, target_status_code=200)
response = self.client.get(url("DUMMY_satchmo_checkout-step3"))
self.assertContains(
response, smart_str("Shipping + %s4.00" % config_value("SHOP", "CURRENCY")), count=1, status_code=200
)
self.assertContains(
response, smart_str("Tax + %s4.60" % config_value("SHOP", "CURRENCY")), count=1, status_code=200
)
self.assertContains(
response, smart_str("Total = %s54.60" % config_value("SHOP", "CURRENCY")), count=1, status_code=200
)
response = self.client.post(url("DUMMY_satchmo_checkout-step3"), {"process": "True"})
self.assertRedirects(response, url("DUMMY_satchmo_checkout-success"), status_code=302, target_status_code=200)
self.assertEqual(len(mail.outbox), 1)
# Log in as a superuser
user = User.objects.create_user("fredsu", "[email protected]", "passwd")
user.is_staff = True
user.is_superuser = True
user.save()
self.client.login(username="fredsu", password="passwd")
# Test pdf generation
response = self.client.get("/admin/print/invoice/1/")
self.assertContains(response, "reportlab", status_code=200)
response = self.client.get("/admin/print/packingslip/1/")
self.assertContains(response, "reportlab", status_code=200)
response = self.client.get("/admin/print/shippinglabel/1/")
self.assertContains(response, "reportlab", status_code=200)
开发者ID:sankroh,项目名称:satchmo,代码行数:53,代码来源:tests.py
示例11: testOrderSuccess
def testOrderSuccess(self):
"""Test cert creation on order success"""
cache_delete()
order = make_test_order('US', '')
order.order_success()
certs = order.giftcertificates.all()
self.assertEqual(len(certs), 1)
c = certs[0]
self.assertEqual(c.balance, Decimal('20.00'))
self.assertEqual(c.recipient_email, '[email protected]')
self.assertEqual(c.message, 'hello there')
开发者ID:juderino,项目名称:jelly-roll,代码行数:12,代码来源:tests.py
示例12: testDelete
def testDelete(self):
caching.cache_set("del", value=True)
for x in range(0, 10):
caching.cache_set("del", "x", x, value=True)
for y in range(0, 5):
caching.cache_set("del", "x", x, "y", y, value=True)
# check to make sure all the values are in the cache
self.assertTrue(caching.cache_get("del", default=False))
for x in range(0, 10):
self.assertTrue(caching.cache_get("del", "x", x, default=False))
for y in range(0, 5):
self.assertTrue(caching.cache_get("del", "x", x, "y", y, default=False))
# try to delete just one
killed = caching.cache_delete("del", "x", 1)
self.assertEqual([caching.CACHE_PREFIX + "::del::x::1"], killed)
self.assertFalse(caching.cache_get("del", "x", 1, default=False))
# but the others are still there
self.assertTrue(caching.cache_get("del", "x", 2, default=False))
# now kill all of del::x::1
killed = caching.cache_delete("del", "x", 1, children=True)
for y in range(0, 5):
self.assertFalse(caching.cache_get("del", "x", 1, "y", y, default=False))
# but del::x::2 and children are there
self.assertTrue(caching.cache_get("del", "x", 2, "y", 1, default=False))
# kill the rest
killed = caching.cache_delete("del", children=True)
self.assertFalse(caching.cache_get("del", default=False))
for x in range(0, 10):
self.assertFalse(caching.cache_get("del", "x", x, default=False))
for y in range(0, 5):
self.assertFalse(
caching.cache_get("del", "x", x, "y", y, default=False)
)
开发者ID:ToeKnee,项目名称:jelly-roll,代码行数:40,代码来源:tests.py
示例13: testPercentShipping
def testPercentShipping(self):
"""Test percent tax with shipping"""
cache_delete()
tax = config_get('TAX','MODULE')
tax.update('satchmo.tax.modules.percent')
pcnt = config_get('TAX', 'PERCENT')
pcnt.update('10')
shp = config_get('TAX', 'TAX_SHIPPING')
shp.update(False)
order = make_test_order('US', 'TX')
shp.update(True)
order.recalculate_total(save=False)
price = order.total
tax = order.tax
self.assertEqual(tax, Decimal('11.00'))
# 100 + 10 shipping + 11 tax
self.assertEqual(price, Decimal('121.00'))
taxes = order.taxes.all()
self.assertEqual(2, len(taxes))
t1 = taxes[0]
t2 = taxes[1]
self.assert_('Shipping' in (t1.description, t2.description))
if t1.description == 'Shipping':
tship = t1
tmain = t2
else:
tship = t2
tmain = t1
self.assertEqual(tmain.tax, Decimal('10.00'))
self.assertEqual(tmain.description, r'10%')
self.assertEqual(tship.tax, Decimal('1.00'))
self.assertEqual(tship.description, 'Shipping')
开发者ID:jimmcgaw,项目名称:levicci,代码行数:36,代码来源:tests.py
示例14: testDelete
def testDelete(self):
caching.cache_set('del', value=True)
for x in range(0,10):
caching.cache_set('del', 'x', x, value=True)
for y in range(0,5):
caching.cache_set('del', 'x', x, 'y', y, value=True)
# check to make sure all the values are in the cache
self.assert_(caching.cache_get('del', default=False))
for x in range(0,10):
self.assert_(caching.cache_get('del', 'x', x, default=False))
for y in range(0,5):
self.assert_(caching.cache_get('del', 'x', x, 'y', y, default=False))
# try to delete just one
killed = caching.cache_delete('del','x',1)
self.assertEqual(["del::x::1"], killed)
self.assertFalse(caching.cache_get('del', 'x', 1, default=False))
# but the others are still there
self.assert_(caching.cache_get('del', 'x', 2, default=False))
# now kill all of del::x::1
killed = caching.cache_delete('del','x', 1, children=True)
for y in range(0,5):
self.assertFalse(caching.cache_get('del', 'x', 1, 'y', y, default=False))
# but del::x::2 and children are there
self.assert_(caching.cache_get('del','x',2,'y',1, default=False))
# kill the rest
killed = caching.cache_delete('del', children=True)
self.assertFalse(caching.cache_get('del',default=False))
for x in range(0,10):
self.assertFalse(caching.cache_get('del', 'x', x, default=False))
for y in range(0,5):
self.assertFalse(caching.cache_get('del', 'x', x, 'y', y, default=False))
开发者ID:davemerwin,项目名称:satchmo,代码行数:38,代码来源:tests.py
注:本文中的satchmo.caching.cache_delete函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论