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')
def getMemberBynameAndPassword(username, password): if not DALMember.memberExists(username, password): raise SoundException(SoundError.WRONG_USERNAME_OR_PASSWORD) return Member(username, Tone(DALMember.getMemberProgress(username)))