def test_aendere_beiVollerDatenbank(self):
        component_under_test = Einzelbuchungen()
        component_under_test.add(datum('01.01.2017'), '3kategorie', '3name',
                                 1.54)
        component_under_test.add(datum('02.01.2017'), '2kategorie', '2name',
                                 1.54)
        component_under_test.add(datum('03.01.2017'), '1kategorie', '1name',
                                 1.54)

        assert component_under_test.content.Datum[0] == datum('01.01.2017')

        component_under_test.edit(0, datum('15.01.2017'),
                                  'some other kategorie', 'some other name',
                                  2.65)

        assert len(component_under_test.content) == 3
        assert set(component_under_test.content.Name) == set(
            ['1name', '2name', 'some other name'])
        assert set(component_under_test.content.Datum) == set(
            [datum('02.01.2017'),
             datum('03.01.2017'),
             datum('15.01.2017')])

        changed_row = component_under_test.content[
            component_under_test.content.Datum == datum('15.01.2017')]
        changed_row.reset_index(drop=True, inplace=True)
        assert changed_row.Name[0] == 'some other name'
        assert changed_row.Kategorie[0] == 'some other kategorie'
        assert changed_row.Wert[0] == 2.65
 def test_edit_shouldTaint(self):
     component_under_test = Einzelbuchungen()
     component_under_test.add(datum('1.1.2010'), 'some kategorie',
                              'some name', 1.23)
     assert component_under_test.taint_number() == 1
     component_under_test.edit(0, datum('2.1.2010'), 'some other kategorie',
                               'some other name', 2.34)
     assert component_under_test.taint_number() == 2
    def test_edit_einzelbuchung_shouldRefreshSortingOfEinzelbuchungen(self):
        component_under_test = Einzelbuchungen()
        component_under_test.add(datum('01.01.2012'), '1kategorie', '1name', 1)
        component_under_test.add(datum('01.01.2011'), '1kategorie', '1name', 1)
        component_under_test.add(datum('01.01.2013'), '1kategorie', '1name', 1)

        component_under_test.edit(0, datum('01.01.2020'), '1kategorie',
                                  '1name', 1)

        assert component_under_test.get_all().Datum[0].year == 2012
        assert component_under_test.get_all().Datum[1].year == 2013
        assert component_under_test.get_all().Datum[2].year == 2020
    def test_aendere_beiEinzigerEinzelbuchung(self):
        component_under_test = Einzelbuchungen()
        component_under_test.add(date.today(), 'some kategorie', 'some name',
                                 1.54)
        component_under_test.edit(0, date.today(), 'some other kategorie',
                                  'some other name', 2.65)

        assert len(component_under_test.content) == 1
        assert component_under_test.content.Datum[0] == date.today()
        assert component_under_test.content.Name[0] == 'some other name'
        assert component_under_test.content.Kategorie[
            0] == 'some other kategorie'
        assert component_under_test.content.Wert[0] == 2.65