Exemplo n.º 1
0
def test_update_money(load_json_mock):
    load_json_mock.side_effect = fake_loader
    new_money = MONEY * 3
    party_info = PartyInfo(PATH)
    party_info.update_money(new_money)
    assert party_info.money() == str(new_money)
    assert MAIN_DATA['Money'] == new_money
Exemplo n.º 2
0
def test_save_edits_header_name(load_json_mock, save_json_mock):
    load_json_mock.side_effect = fake_loader
    character_name = main_character(PARTY)['Descriptor']['CustomName']
    party_info = PartyInfo(PATH)
    expected_save_name = 'Edited - ' + HEADER['Name']
    party_info.save()
    assert HEADER['Name'] == expected_save_name
def test_save_data(load_json_mock, save_json_mock):
    load_json_mock.side_effect = fake_loader
    character_name = main_character(PARTY)['Descriptor']['CustomName']
    party_info = PartyInfo(PATH)
    party_info.save()
    expected_calls = [call(PATH, PLAYER_JSON, MAIN_DATA),
                      call(PATH, PARTY_JSON, PARTY),
                      call(PATH, HEADER_JSON, HEADER)]
    save_json_mock.assert_has_calls(expected_calls)
def test_companions(load_json_mock):
    load_json_mock.side_effect = fake_loader
    character_name = companion_expected_name(COMPANION_ID)
    party_info = PartyInfo(PATH)
    character = party_info.members[character_name]
    assert isinstance(character, CompanionInfo)
    assert character.name() == character_name
def test_main_character(load_json_mock):
    load_json_mock.side_effect = fake_loader
    character_name = main_character(PARTY)['Descriptor']['CustomName']
    party_info = PartyInfo(PATH)
    character = party_info.members[character_name]
    assert isinstance(character, CharacterInfo)
    assert character.name() == character_name
Exemplo n.º 6
0
class Tabs():
    def __init__(self, parent):
        self._parent = parent
        self._party = None
        self._notebook = ttk.Notebook(parent, style='Default.TNotebook')
        self._main = CharacterTab(self._notebook, parent)
        self._kingdom_tab = KingdomInfoTab(self._notebook)
        self._expand()

    def load_info(self):
        self._party = PartyInfo(self._parent.temp_path)
        self._main.load_info(self._party)
        self._kingdom_tab.load_info(self._party)
        self._expand()

    def update_info(self):
        self._party.save()

    def _expand(self):
        self._notebook.pack(expand=1, fill=BOTH)
        self._parent.config()
Exemplo n.º 7
0
class Tabs():
    def __init__(self, parent):
        self._parent = parent
        self._party = None
        self._name_panel = NameFrame(parent)
        self._notebook = ttk.Notebook(parent, style='Default.TNotebook')
        self._player_tab = PlayerInfoTab(self._notebook)
        self._skill_tab = SkillInfoTab(self._notebook)
        self._kingdom_tab = KingdomInfoTab(self._notebook)
        self._notebook.pack(expand=1, fill=BOTH)

    def load_info(self, path):
        self._party = PartyInfo(self._parent.temp_path)
        self._name_panel.load_info(self._party.main_character)
        self._player_tab.load_info(self._party)
        self._skill_tab.load_info(self._party)
        self._kingdom_tab.load_info(self._party)

    def update_info(self, path):
        self._player_tab.update_info(self._party)
        self._skill_tab.update_info(self._party)
        self._kingdom_tab.update_info(self._party)
        self._party.save()
Exemplo n.º 8
0
 def load_info(self, path):
     self._party = PartyInfo(self._parent.temp_path)
     self._name_panel.load_info(self._party.main_character)
     self._player_tab.load_info(self._party)
     self._skill_tab.load_info(self._party)
     self._kingdom_tab.load_info(self._party)
Exemplo n.º 9
0
 def load_info(self):
     self._party = PartyInfo(self._parent.temp_path)
     self._main.load_info(self._party)
     self._kingdom_tab.load_info(self._party)
     self._expand()
Exemplo n.º 10
0
def test_skills_info(load_json_mock):
    load_json_mock.side_effect = fake_loader
    party_info = PartyInfo(PATH)
    assert party_info.kingdom.has_kingdom_data()
Exemplo n.º 11
0
def test_money(load_json_mock):
    load_json_mock.side_effect = fake_loader
    party_info = PartyInfo(PATH)
    assert party_info.money() == str(MONEY)