当前位置: 首页>>代码示例>>Python>>正文


Python UserData.createUser方法代码示例

本文整理汇总了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()
开发者ID:jab0ii,项目名称:pgfwd,代码行数:13,代码来源:ui_tests.py

示例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()
开发者ID:jab0ii,项目名称:pgfwd,代码行数:32,代码来源:tests_func.py

示例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))
开发者ID:jab0ii,项目名称:pgfwd,代码行数:27,代码来源:tests_func.py

示例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)
开发者ID:jab0ii,项目名称:pgfwd,代码行数:23,代码来源:tests.py


注:本文中的models.UserData.createUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。