本文整理汇总了Python中market.profile.Profile.add_social_account方法的典型用法代码示例。如果您正苦于以下问题:Python Profile.add_social_account方法的具体用法?Python Profile.add_social_account怎么用?Python Profile.add_social_account使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类market.profile.Profile
的用法示例。
在下文中一共展示了Profile.add_social_account方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_MarketProfile_add_social_invalid
# 需要导入模块: from market.profile import Profile [as 别名]
# 或者: from market.profile.Profile import add_social_account [as 别名]
def test_MarketProfile_add_social_invalid(self):
p = Profile(self.db)
p.add_social_account("TEST", "test_twitter_username")
u = p.get()
self.assertEqual(1, len(u.social))
self.assertEqual(0, u.social[0].type)
self.assertEqual('test_fb_username', u.social[0].username)
示例2: test_MarketProfile_replace_social_no_proof
# 需要导入模块: from market.profile import Profile [as 别名]
# 或者: from market.profile.Profile import add_social_account [as 别名]
def test_MarketProfile_replace_social_no_proof(self):
p = Profile(self.db)
p.add_social_account("FACEBOOK", "test_updated_username")
u = p.get()
self.assertEqual(1, len(u.social))
self.assertEqual(0, u.social[0].type)
self.assertEqual('test_updated_username', u.social[0].username)
示例3: test_MarketProfile_add_social_no_proof
# 需要导入模块: from market.profile import Profile [as 别名]
# 或者: from market.profile.Profile import add_social_account [as 别名]
def test_MarketProfile_add_social_no_proof(self):
p = Profile(self.db)
p.add_social_account("TWITTER", "test_twitter_username")
u = p.get()
self.assertEqual(2, len(u.social))
self.assertEqual(0, u.social[0].type)
self.assertEqual('test_fb_username', u.social[0].username)
self.assertEqual(1, u.social[1].type)
self.assertEqual('test_twitter_username', u.social[1].username)
示例4: addsocialaccount
# 需要导入模块: from market.profile import Profile [as 别名]
# 或者: from market.profile.Profile import add_social_account [as 别名]
def addsocialaccount():
parser = argparse.ArgumentParser(
description="Add a social media account to the profile.",
usage='''usage:
networkcli.py addsocialaccout -t TYPE, -u USERNAME, -p PROOF''')
parser.add_argument('-t', '--type', help="the type of account")
parser.add_argument('-u', '--username', help="the username")
parser.add_argument('-p', '--proof', help="the proof url")
args = parser.parse_args(sys.argv[2:])
p = Profile()
p.add_social_account(args.type, args.username, args.proof)
示例5: add_social_account
# 需要导入模块: from market.profile import Profile [as 别名]
# 或者: from market.profile.Profile import add_social_account [as 别名]
def add_social_account(self, request):
try:
p = Profile(self.db)
if "account_type" in request.args and "username" in request.args and "proof" in request.args:
p.add_social_account(request.args["account_type"][0], request.args["username"][0],
request.args["proof"][0])
request.write(json.dumps({"success": True}))
request.finish()
return server.NOT_DONE_YET
except Exception, e:
request.write(json.dumps({"success": False, "reason": e.message}, indent=4))
request.finish()
return server.NOT_DONE_YET
示例6: add_social_account
# 需要导入模块: from market.profile import Profile [as 别名]
# 或者: from market.profile.Profile import add_social_account [as 别名]
def add_social_account(self, request):
p = Profile()
if "account_type" in request.args and "username" in request.args and "proof" in request.args:
p.add_social_account(request.args["account_type"][0], request.args["username"][0],
request.args["proof"][0])