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 initializeMember(name, password):
     member = Member(name, Tone.first())
     if DALMember.usernameExists(name):
         raise SoundException(SoundError.USERNAME_TAKEN)
     DALMember.insertMember(name, password, member.__tone.letter)
     return member
Exemplo n.º 3
0
 def getMemberByusername(username):
     if not DALMember.usernameExists(username):
         raise SoundException(SoundError.USERNAME_DOES_NOT_EXIST)
     return Member(username, Tone(DALMember.getMemberProgress(username)))