本文整理汇总了Python中account.Account.get_account方法的典型用法代码示例。如果您正苦于以下问题:Python Account.get_account方法的具体用法?Python Account.get_account怎么用?Python Account.get_account使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类account.Account
的用法示例。
在下文中一共展示了Account.get_account方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_account_returns_data_for_id_1
# 需要导入模块: from account import Account [as 别名]
# 或者: from account.Account import get_account [as 别名]
def test_account_returns_data_for_id_1(self):
account_data = {"id": "1", "name": "test"}
mock_data_interface = Mock()
mock_data_interface.get.return_value = account_data
account = Account(mock_data_interface)
self.assertDictEqual(account_data, account.get_account(1))
示例2:
# 需要导入模块: from account import Account [as 别名]
# 或者: from account.Account import get_account [as 别名]
# set up a terminal emulator
screen = pyte.Screen(80, 24)
stream = pyte.Stream()
stream.attach(screen)
tn = telnetlib.Telnet(SITE_IP)
time.sleep(1)
# read content
content = tn.read_very_eager().decode('uao_decode', 'ignore')
# login
if '請輸入代號' in content:
# write account id
tn.write((account.get_account() + '\r\n').encode('big5'))
time.sleep(1)
content = tn.read_very_eager().decode('uao_decode', 'ignore')
# write password
tn.write((account.get_password() + '\r\n').encode('big5'))
time.sleep(2)
content = tn.read_very_eager().decode('uao_decode', 'ignore')
# check if password incorrect
if '密碼不對' in content:
sys.exit()
# check if exists a session
if '您想刪除其他重複登入的連線嗎' in content:
tn.write('Y\r\n'.encode('big5'))
示例3: test_account_when_connect_exception_raised
# 需要导入模块: from account import Account [as 别名]
# 或者: from account.Account import get_account [as 别名]
def test_account_when_connect_exception_raised(self):
mock_data_interface = Mock()
mock_data_interface.get.side_effect = ConnectionError()
account = Account(mock_data_interface)
self.assertEqual("Connection error occurred. Try again.", account.get_account(1))