Example #1
0
    def test_add_ausgabe_should_only_fire_once(self):
        self.set_up()
        next_id = request_handler.current_key()
        addeinnahme.index(PostRequest(
            {'action':'add',
             'ID':next_id,
             'date': rfc('1.1.2017'),
             'kategorie':'Essen',
             'name':'testname',
             'wert':'2,00'
             }
         ))

        addeinnahme.index(PostRequest(
            {'action':'add',
             'ID':next_id,
             'date': rfc('1.1.2017'),
             'kategorie':'overwritten',
             'name':'overwritten',
             'wert':'0,00'
             }
         ))

        assert len(db().einzelbuchungen.content) == 1
        assert db().einzelbuchungen.content.Wert[0] == float('2.00')
        assert db().einzelbuchungen.content.Name[0] == 'testname'
        assert db().einzelbuchungen.content.Kategorie[0] == 'Essen'
        assert db().einzelbuchungen.content.Datum[0] == datum('1.1.2017')
Example #2
0
    def test_edit_ausgabe(self):
        self.set_up()

        addeinnahme.index(VersionedPostRequest(
            {'action':'add',
             'date': rfc('1.1.2017'),
             'kategorie':'Essen',
             'name':'testname',
             'wert':'2,00'
             }
         ))

        addeinnahme.index(VersionedPostRequest(
            {'action':'add',
             'edit_index':'0',
             'date': rfc('5.1.2017'),
             'kategorie':'Essen',
             'name':'testname',
             'wert':'2,50'
             }
         ))

        assert len(db().einzelbuchungen.content) == 1
        assert db().einzelbuchungen.content.Wert[0] == float('2.50')
        assert db().einzelbuchungen.content.Name[0] == 'testname'
        assert db().einzelbuchungen.content.Kategorie[0] == 'Essen'
        assert db().einzelbuchungen.content.Datum[0] == datum('5.1.2017')
Example #3
0
    def test_edit_einzelbuchung_shouldLoadInputValues(self):
        self.set_up()

        addeinnahme.index(VersionedPostRequest(
            {
                'action': 'add',
                'date': rfc('1.1.2017'),
                'kategorie': 'Essen',
                'name': 'testname',
                'wert': '2,34'
             }
         ))

        result = addeinnahme.index(PostRequest(
            {'action':'edit',
             'edit_index':'0'
             }
        ))

        assert result['edit_index'] == 0
        assert result['default_item']['Name'] == 'testname'
        assert result['default_item']['Wert'] == '2,34'
Example #4
0
def add_einnahme():
    return addeinnahme.index(request)
Example #5
0
 def test_editCallFromUeberischt_shouldNameButtonEdit(self):
     self.set_up()
     db().einzelbuchungen.add(datum('10.10.2010'), 'kategorie', 'name', 10.00)
     context = addeinnahme.index(PostRequest({'action': 'edit', 'edit_index': '0'}))
     assert context['approve_title'] == 'Einnahme aktualisieren'
Example #6
0
 def test_init(self):
     self.set_up()
     context = addeinnahme.index(GetRequest())
     assert context['approve_title'] == 'Einnahme hinzufügen'
Example #7
0
 def test_transaction_id_should_be_in_context(self):
     self.set_up()
     context = addeinnahme.index(GetRequest())
     assert 'ID' in context