示例#1
0
文件: ui_tests.py 项目: jab0ii/pgfwd
    def setUp(self):
        self.sel = WebDriver()

        # Create a user and an org
        self.user = UserData.createUser('a', 'b','c@1', 'pw')
        theOrg = OrgData.createOrg("theOrg")
        self.user.org = theOrg
        self.user.save()
        self.user = UserData.createUser('d', 'e','f@1', 'pw')
        self.user.org = theOrg
        self.user.save()
示例#2
0
    def setUp(self):
        testOrg = OrgData(orgName='Test org',
                          status=1)
        testOrg.pk = 9
        testOrg.save()
      
        self.testUser = UserData.createUser('Test', 'Tester', 
                                       '*****@*****.**', '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='*****@*****.**',
                                              priority=0)
        testContactMethod.pk = 7
        testContactMethod.save()
       

        self.client = Client()

        log = self.client.login(username='******',
                          password='******')
        s = self.client.session
        s['swag'] = 41
        s.save()
示例#3
0
    def test_APILogin(self):
        self.testUserL = UserData.createUser('Test', 'Tester', 
                                       '*****@*****.**', 'pw')
        self.testUserL.apiKey = 'TESTAPIKEY9'
        self.testUserL.save()
        
        testContactMethod = ContactMethodData(user=self.testUserL,
                                              contactType='email',
                                              contactData='*****@*****.**',
                                              priority=0)
        testContactMethod.pk = 11
        testContactMethod.save()
        
        userPCMDict = self.testUserL.toUserPCM().toDict()

        postData = json.dumps({'username':'******',
                               'password':'******'})
        
        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
0
文件: ui_tests.py 项目: jab0ii/pgfwd
    def setUp(self):
        self.sel = WebDriver()

        # Create a user and an org
        self.user = UserData.createUser('firstName', 'lastName','*****@*****.**', 'pw')

        self.user.org = OrgData.createOrg("theOrg")
        self.user.save()
示例#5
0
文件: tests.py 项目: jab0ii/pgfwd
 def testToUserPCM(self):
     testOrg = OrgData(orgName='Test org',
                       status=1)
     testOrg.save()
     testUser = UserData.createUser('Test', 'Tester', 
                                    '*****@*****.**', 'pw')
     testUser.org = testOrg
     testUser.apiKey = 'TESTAPIKEY'
     testUser.save()
     testContactMethod = ContactMethodData(user=testUser,
                                           contactType='email',
                                           contactData='*****@*****.**',
                                           priority=0)
     testContactMethod.save()
     userDict = {'firstName': 'Test', 'lastName': 'Tester',
                 'status': 1, 'orgID': testOrg.pk, 'contactMethods': [
                     {'user': testUser.pk, 'contactType': 'email',
                      'contactData': '*****@*****.**', 'priority': 0,
                      'title': None, 'contactMethodID': testContactMethod.pk
                      }], 'apiKey': 'TESTAPIKEY', 'user': testUser.pk}
     self.assertDictEqual(testUser.toUserPCM().toDict(), userDict)
示例#6
0
文件: ui_tests.py 项目: jab0ii/pgfwd
    def setUp(self):
        self.sel = WebDriver()

        # Create a user
        self.user = UserData.createUser('firstName', 'lastName',
                                        '*****@*****.**', 'pw')