コード例 #1
0
    def testAliceAndBadUsername(self):
        bad_username = "******"
        users = phlcon_user.query_users_from_usernames(
            self.conduit, [self.test_user, bad_username])
        self.assertIsNone(users)

        userDict = phlcon_user.make_username_phid_dict(
            self.conduit, [self.test_user, bad_username])
        self.assertIsNone(userDict)
コード例 #2
0
    def testAliceAndBadPhid(self):
        users = phlcon_user.query_users_from_usernames(
            self.conduit, [self.test_user])
        self.assertEqual(len(users), 1)
        self.assertEqual(users[0].userName, self.test_user)

        bad_phid = "asd9f87"
        phidDict = phlcon_user.make_phid_username_dict(
            self.conduit, [users[0].phid, bad_phid])
        self.assertIsNone(phidDict)
コード例 #3
0
    def testEmptyLists(self):
        users = phlcon_user.query_users_from_usernames(self.conduit, [])
        self.assertEqual(len(users), 0)

        users = phlcon_user.query_users_from_phids(self.conduit, [])
        self.assertEqual(len(users), 0)

        users = phlcon_user.query_usernames_from_phids(self.conduit, [])
        self.assertEqual(len(users), 0)

        users = phlcon_user.query_users_from_emails(self.conduit, [])
        self.assertEqual(len(users), 0)
コード例 #4
0
    def testAliceUsername(self):
        users = phlcon_user.query_users_from_usernames(
            self.conduit, [self.test_user])
        self.assertEqual(len(users), 1)
        self.assertEqual(users[0].userName, self.test_user)

        userDict = phlcon_user.make_username_phid_dict(
            self.conduit, [self.test_user])
        self.assertEqual(len(userDict), 1)
        self.assertEqual(userDict[self.test_user], users[0].phid)

        username = users[0].userName
        phid = users[0].phid
        phidDict = phlcon_user.make_phid_username_dict(self.conduit, [phid])
        self.assertEqual(len(phidDict), 1)
        self.assertEqual(phidDict[phid], username)