Ejemplo n.º 1
0
    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(
            PostRequest({
                'action': 'add',
                'ID': request_handler.current_key(),
                'edit_index': '0',
                'date': rfc('5.1.2017'),
                'kategorie': 'Essen',
                'name': 'testname',
                'person': 'testperson2',
                'wert': '2,50'
            }))

        testdb = viewcore.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'
Ejemplo n.º 2
0
 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 = viewcore.database_instance()
     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'
Ejemplo n.º 3
0
    def test_personenOption_shouldContainNames(self):
        self.set_up()
        result = addgemeinsam.index(GetRequest())

        assert viewcore.database_instance().name in result['personen']
        assert viewcore.name_of_partner() in result['personen']
        assert len(result['personen']) == 2
Ejemplo n.º 4
0
 def test_add_shouldAddGemeinsameBuchung(self):
     self.set_up()
     addgemeinsam.index(
         VersionedPostRequest({
             'action': 'add',
             'date': rfc('1.1.2017'),
             'kategorie': 'Essen',
             'name': 'testname',
             'person': 'testperson',
             'wert': '2,00'
         }))
     testdb = viewcore.database_instance()
     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'
Ejemplo n.º 5
0
 def test_editCallFromUeberischt_shouldNameButtonEdit(self):
     self.set_up()
     db = viewcore.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'
Ejemplo n.º 6
0
 def test_init(self):
     self.set_up()
     context = addgemeinsam.index(GetRequest())
     assert context['approve_title'] == 'Gemeinsame Ausgabe hinzufügen'