Exemple #1
0
    def test_getProfileByID(self):

        db = PSTMirrorDB()
        # 821 - pst_id for pmargani
        globalId = 821
        info = db.getStaticContactInfoByID(globalId)

        # expected values
        emails = ['*****@*****.**'
                , '*****@*****.**'
                , '*****@*****.**']
        emailDescs = ['[email protected] (Work)'
                    , '[email protected] (Other)'
                    , '[email protected] (Personal)']
        phones = ['304-456-2202', '304-456-2206']
        phoneDescs = ['304-456-2202 (Work)', '304-456-2206 (Other)']
        postals = \
            ['NRAO, PO Box 2, Green Bank, West Virginia, 24944, USA, (Office)'
           , '49 columbus Ave., W. Bridgewater, Massachusetts, 02379, United States, (Other)']
        affiliations = [u'National Radio Astronomy Observatory'
                      , u'Oregon, University of']
        self.assertEquals(emails, info['emails'])
        self.assertEquals(emailDescs, info['emailDescs'])
        self.assertEquals(phones, info['phones'])
        self.assertEquals(phoneDescs, info['phoneDescs'])
        self.assertEquals(postals, info['postals'])
        self.assertEquals(affiliations, info['affiliations'])
        self.assertEquals('pmargani', info['username'])
        self.assertEquals(True, info['status'])
        self.assertEquals(globalId, info['person_id'])
        self.assertEquals(823, info['personAuth_id'])
Exemple #2
0
    def test_getUserAuthenticationIdFromId(self):

        db = PSTMirrorDB()
        globalId = 821
        userAuthId = 823
        username = '******'
        id = db.getUserAuthenticationIdFromId(globalId)
        self.assertEquals(userAuthId, id)
Exemple #3
0
    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)
Exemple #4
0
from nell.utilities.database.external import UserInfo, PSTMirrorDB
from scheduler.models import *

# Utility for taking in a list of usernames from computing, and 
# seeing who should be deleted and who shouldn't

pst = PSTMirrorDB()


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:
Exemple #5
0
    def test_getBadProfile(self):
        "Make sure we can handle bogus info."

        db = PSTMirrorDB()
        username = db.getUsername(0)
        self.assertEquals(None, username)