本文整理汇总了Python中models.UserData.createUser方法的典型用法代码示例。如果您正苦于以下问题:Python UserData.createUser方法的具体用法?Python UserData.createUser怎么用?Python UserData.createUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.UserData
的用法示例。
在下文中一共展示了UserData.createUser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from models import UserData [as 别名]
# 或者: from models.UserData import createUser [as 别名]
def setUp(self):
self.sel = WebDriver()
# Create a user and an org
self.user = UserData.createUser('a', 'b','[email protected]', 'pw')
theOrg = OrgData.createOrg("theOrg")
self.user.org = theOrg
self.user.save()
self.user = UserData.createUser('d', 'e','[email protected]', 'pw')
self.user.org = theOrg
self.user.save()
示例2: setUp
# 需要导入模块: from models import UserData [as 别名]
# 或者: from models.UserData import createUser [as 别名]
def setUp(self):
testOrg = OrgData(orgName='Test org',
status=1)
testOrg.pk = 9
testOrg.save()
self.testUser = UserData.createUser('Test', 'Tester',
'[email protected]', 'pw')
self.testUser.org = testOrg
self.testUser.apiKey = 'TESTAPIKEY8'
self.testUser.save()
self.hierarchy = '{"numLevels":1,"levels":{"0":{"timeout":30,\
"users":[' + str(self.testUser.pk) + ']}}}'
testContactMethod = ContactMethodData(user=self.testUser,
contactType='email',
contactData='[email protected]',
priority=0)
testContactMethod.pk = 7
testContactMethod.save()
self.client = Client()
log = self.client.login(username='[email protected]',
password='pw')
s = self.client.session
s['swag'] = 41
s.save()
示例3: test_APILogin
# 需要导入模块: from models import UserData [as 别名]
# 或者: from models.UserData import createUser [as 别名]
def test_APILogin(self):
self.testUserL = UserData.createUser('Test', 'Tester',
'[email protected]', 'pw')
self.testUserL.apiKey = 'TESTAPIKEY9'
self.testUserL.save()
testContactMethod = ContactMethodData(user=self.testUserL,
contactType='email',
contactData='[email protected]',
priority=0)
testContactMethod.pk = 11
testContactMethod.save()
userPCMDict = self.testUserL.toUserPCM().toDict()
postData = json.dumps({'username':'[email protected]',
'password':'pw'})
response = self.client.post(APP_URL + '/API/login',
postData, content_type = "application/json")
responses = {'userPCM': userPCMDict,
'error': None}
self.assertEqual(responses, json.loads(response.content))
示例4: testToUserPCM
# 需要导入模块: from models import UserData [as 别名]
# 或者: from models.UserData import createUser [as 别名]
def testToUserPCM(self):
testOrg = OrgData(orgName='Test org',
status=1)
testOrg.save()
testUser = UserData.createUser('Test', 'Tester',
'[email protected]', 'pw')
testUser.org = testOrg
testUser.apiKey = 'TESTAPIKEY'
testUser.save()
testContactMethod = ContactMethodData(user=testUser,
contactType='email',
contactData='[email protected]',
priority=0)
testContactMethod.save()
userDict = {'firstName': 'Test', 'lastName': 'Tester',
'status': 1, 'orgID': testOrg.pk, 'contactMethods': [
{'user': testUser.pk, 'contactType': 'email',
'contactData': '[email protected]', 'priority': 0,
'title': None, 'contactMethodID': testContactMethod.pk
}], 'apiKey': 'TESTAPIKEY', 'user': testUser.pk}
self.assertDictEqual(testUser.toUserPCM().toDict(), userDict)