def test_getIdFromUsername(self): db = PSTMirrorDB() globalId = 821 username = '******' id = db.getIdFromUsername(username) self.assertEquals(globalId, id) un = db.getUsername(globalId) self.assertEquals(username, un)
filename = 'oldUsers.txt' f = open(filename, 'r') lines = f.readlines() notInPst = [] notInDss = [] scheduled = [] notScheduled = [] notComplete = [] for l in lines: username = l.split(" ")[0].strip() pst_id = None u = None try: pst_id = pst.getIdFromUsername(username) except: pst_id = None notInPst.append(username) if pst_id is not None: try: u = User.objects.get(pst_id = pst_id) except: u = None notInDss.append(username) if u is not None: notCmps = [pcode for pcode in u.getProjects() if not Project.objects.get(pcode = pcode).complete] if len(notCmps) > 0: print " ", username notComplete.append(username) if len(u.getUpcomingPeriods()) > 0: