Exemplo n.º 1
0
def test_insertMember():
    if os.path.isdir(datapath):
        shutil.rmtree(datapath)
    Data.initializeData()
    DALMember.insertMember('dan', '123', 'a')
    assert (DALMember.memberExists('dan', '123'))
    assert (not DALMember.memberExists('dan', '12'))
    assert (not DALMember.memberExists('da', '123'))

    assert (DALMember.usernameExists('dan'))
    assert (not DALMember.usernameExists('da'))

    assert (DALMember.getMemberProgress('dan') == 'a')
    DALMember.insertMember('1', '2', '3')
    assert (DALMember.getAllMembers() == [('dan', 'a', '123'),
                                          ('1', '3', '2')])

    DALMember.updateUserProgress('b', 'dan')
    assert (DALMember.getMemberProgress('dan') == 'b')
Exemplo n.º 2
0
 def getAllMembers():
     rows = DALMember.getAllMembers()
     members = {}
     for row in rows:
         members[row[0]] = row[1]
     return members