本文整理匯總了Python中test_factory.Factory.rand_str方法的典型用法代碼示例。如果您正苦於以下問題:Python Factory.rand_str方法的具體用法?Python Factory.rand_str怎麽用?Python Factory.rand_str使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類test_factory.Factory
的用法示例。
在下文中一共展示了Factory.rand_str方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_that_new_donations_can_include_a_type_and_notes
# 需要導入模塊: from test_factory import Factory [as 別名]
# 或者: from test_factory.Factory import rand_str [as 別名]
def test_that_new_donations_can_include_a_type_and_notes(self):
sel = self.selenium
self.create_person_and_go_to_donor_tab()
notes_str = Factory.rand_str()
a1, d1 = self.add_a_donation(amount=85.8, date="3/8/2011", type="Check", notes=notes_str)
# make sure recent donations display cleanly
self.assertEqual("$%.2f"%a1, sel.get_text("css=.donor_donation_table .donation_row:nth(0) .amount"))
self.assertEqual("March 8, 2011", sel.get_text("css=.donor_donation_table .donation_row:nth(0) .date"))
self.assertEqual("Check", sel.get_text("css=.donor_donation_table .donation_row:nth(0) .type"))
self.assertEqual("Notes: %s" % notes_str, sel.get_text("css=.donor_donation_table .donation_row:nth(0) .notes_body"))
示例2: add_a_conversation
# 需要導入模塊: from test_factory import Factory [as 別名]
# 或者: from test_factory.Factory import rand_str [as 別名]
def add_a_conversation(self, body=None, date=None, type="in-person"):
sel = self.selenium
self.switch_to_conversation_tab()
if not body:
body = Factory.rand_str(500)
if not date:
d = Factory.rand_date()
date = "%02d/%02d/%02d" % (d.month, d.day, d.year)
sel.click("css=tabbed_box[name=add_a_conversation] tab_title")
sel.type("css=#id_body", body)
sel.click("css=input[name=conversation_type][value=%s]" % (type,))
sel.type("css=#id_date", date)
sel.click("css=tabbed_box[name=add_a_conversation] .add_conversation_btn")
time.sleep(2)
return body,date