def test_quest_note_fields(journal): journal.start_quest('orciad') journal.add_quest_note('orciad', 'note2') assert journal.quests['orciad']['notes'][0] == { 'note': 'note2', 'new': True, 'completed': False }
def test_adding_duplicate_note(journal): journal.start_quest('orciad') journal.add_quest_note('orciad', 'note2') journal.add_quest_note('orciad', 'note3') journal.read_all() assert journal.new_entries() == 0 journal.add_quest_note('orciad', 'note3') assert journal.new_entries() == 0
def test_complete_note(journal): journal.start_quest('orciad') journal.add_quest_note('orciad', 'note2') journal.add_quest_note('orciad', 'note3') assert journal.new_entries() == 1 journal.read_all() assert journal.new_entries() == 0 journal.complete_quest_note('orciad', 'note2') assert journal.new_entries() == 1 assert journal.quests['orciad']['notes'][0]['completed'] == True assert journal.quests['orciad']['notes'][1]['completed'] == False
def test_complete_note_twice(journal): journal.start_quest('orciad') journal.add_quest_note('orciad', 'note4') journal.add_quest_note('orciad', 'note1') journal.read_all() assert journal.new_entries() == 0 journal.complete_quest_note('orciad', 'note4') assert journal.new_entries() == 1 assert journal.quests['orciad']['notes'][0]['completed'] == True # try to complete note again journal.read_all() journal.complete_quest_note('orciad', 'note4') assert journal.new_entries() == 0 assert journal.quests['orciad']['notes'][0]['completed'] == True
def test_adding_quests_and_notes(journal): assert journal.quests == {} journal.start_quest('orciad') assert journal.quests == { 'orciad': { 'new': True, 'state': 'In progress', 'notes': [] } } assert journal.new_quests() == 1 assert journal.new_entries() == 1 journal.quests_read('orciad') assert journal.new_quests() == 0 journal.add_quest_note('orciad', 'note2') journal.add_quest_note('orciad', 'note4') assert journal.new_quests() == 1 assert len( [rec for rec in journal.quests['orciad']['notes'] if rec['new']]) == 2 # check that "new" marks on notes are also reset journal.quests_read('orciad') assert journal.new_quests() == 0 assert len( [rec for rec in journal.quests['orciad']['notes'] if rec['new']]) == 0