def test_edit_ausgabe(self): self.set_up() addgemeinsam.index( VersionedPostRequest({ 'action': 'add', 'date': rfc('1.1.2017'), 'kategorie': 'Essen', 'name': 'testname', 'person': 'testperson', 'wert': '2,00' })) addgemeinsam.index( VersionedPostRequest({ 'action': 'add', 'edit_index': '0', 'date': rfc('5.1.2017'), 'kategorie': 'Essen', 'name': 'testname', 'person': 'testperson2', 'wert': '2,50' })) testdb = persisted_state.database_instance() assert testdb.gemeinsamebuchungen.content.Wert[0] == -1 * float('2.50') assert testdb.gemeinsamebuchungen.content.Name[0] == 'testname' assert testdb.gemeinsamebuchungen.content.Kategorie[0] == 'Essen' assert testdb.gemeinsamebuchungen.content.Datum[0] == datum('5.1.2017') assert testdb.gemeinsamebuchungen.content.Person[0] == 'testperson2'
def test_add_should_only_fire_once(self): self.set_up() next_id = request_handler.current_key() addgemeinsam.index( PostRequest({ 'action': 'add', 'ID': next_id, 'date': rfc('1.1.2017'), 'kategorie': 'Essen', 'name': 'testname', 'person': 'testperson', 'wert': '2,00' })) addgemeinsam.index( PostRequest({ 'action': 'add', 'ID': next_id, 'date': rfc('1.1.2017'), 'kategorie': 'overwritten', 'name': 'overwritten', 'person': 'overwritten', 'wert': '0,00' })) testdb = persisted_state.database_instance() assert len(testdb.gemeinsamebuchungen.content) == 1 assert testdb.gemeinsamebuchungen.content.Wert[0] == -1 * float('2.00') assert testdb.gemeinsamebuchungen.content.Name[0] == 'testname' assert testdb.gemeinsamebuchungen.content.Kategorie[0] == 'Essen' assert testdb.gemeinsamebuchungen.content.Datum[0] == datum('1.1.2017') assert testdb.gemeinsamebuchungen.content.Person[0] == 'testperson'
def test_personenOption_shouldContainNames(self): self.set_up() result = addgemeinsam.index(GetRequest()) assert persisted_state.database_instance().name in result['personen'] assert viewcore.name_of_partner() in result['personen'] assert len(result['personen']) == 2
def test_add_shouldAddDynamicEinzelbuchung(self): self.set_up() addgemeinsam.index( VersionedPostRequest({ 'action': 'add', 'date': rfc('1.1.2017'), 'kategorie': 'Essen', 'name': 'testname', 'person': 'testperson', 'wert': '2,00' })) testdb = persisted_state.database_instance() assert testdb.einzelbuchungen.content.Wert[0] == -1 * 0.5 * float( '2.00') assert testdb.einzelbuchungen.content.Kategorie[0] == 'Essen' assert testdb.einzelbuchungen.content.Datum[0] == datum('1.1.2017') assert testdb.einzelbuchungen.content.Name[ 0] == 'testname (noch nicht abgerechnet, von testperson)'
def test_editCallFromUeberischt_shouldPresetValues_andRenameButton(self): self.set_up() db = persisted_state.database_instance() db.gemeinsamebuchungen.add(datum('10.10.2010'), 'kategorie', 'ausgaben_name', -10, 'Sebastian') context = addgemeinsam.index( PostRequest({ 'action': 'edit', 'edit_index': '0' })) assert context['approve_title'] == 'Gemeinsame Ausgabe aktualisieren' preset = context['default_item'] assert preset['datum'] == rfc('10.10.2010') assert preset['edit_index'] == '0' assert preset['kategorie'] == 'kategorie' assert preset['name'] == 'ausgaben_name' assert preset['wert'] == '10,00' assert preset['person'] == 'Sebastian'
def add_gemeinsam(): return addgemeinsam.index(request)
def test_transaction_id_should_be_in_context(self): self.set_up() context = addgemeinsam.index(GetRequest()) assert 'ID' in context
def test_init(self): self.set_up() context = addgemeinsam.index(GetRequest()) assert context['approve_title'] == 'Gemeinsame Ausgabe hinzufügen'