コード例 #1
0
    def test_set_kategorien_with_ausgeschlossene_kategoerien_should_hide_ausgeschlossene_kategorien(
            self):
        self.set_up()

        viewcore.database_instance().einzelbuchungen.add(
            datum('20.01.1990'), 'JaEins', 'SomeTitle', -10)
        viewcore.database_instance().einzelbuchungen.add(
            datum('20.01.1990'), 'NeinEins', 'SomeTitle', -10)
        viewcore.database_instance().einzelbuchungen.add(
            datum('20.01.1990'), 'JaZwei', 'SomeTitle', -10)

        configuration.index(
            PostRequest({
                'action': 'set_ausgeschlossene_kategorien',
                'ausgeschlossene_kategorien': 'NeinEins'
            }))

        requester.INSTANCE = RequesterStub(
            {'https://test.test/setkategorien.php': ''})

        context = import_data.index(
            PostRequest({
                'action': 'set_kategorien',
                'email': '',
                'server': 'test.test',
                'password': ''
            }))

        assert requester.instance().data_of_request(
            'https://test.test/setkategorien.php'
        )[0]['kategorien'] == 'JaEins,JaZwei'
コード例 #2
0
 def test_change_partnername_should_change_partnername(self):
     self.set_up()
     assert viewcore.name_of_partner() == 'kein_Partnername_gesetzt'
     configuration.index(
         PostRequest({
             'action': 'set_partnername',
             'partnername': 'testpartner'
         }))
     assert viewcore.name_of_partner() == 'testpartner'
コード例 #3
0
 def test_addKategorie(self):
     self.set_up()
     configuration.index(
         PostRequest({
             'action': 'add_kategorie',
             'neue_kategorie': 'test'
         }))
     assert viewcore.database_instance(
     ).einzelbuchungen.get_alle_kategorien() == set(['test'])
コード例 #4
0
 def test_change_themecolor_should_change_partnername(self):
     self.set_up()
     assert configuration_provider.get_configuration(
         'AUSGESCHLOSSENE_KATEGORIEN') == ''
     configuration.index(
         PostRequest({
             'action': 'set_ausgeschlossene_kategorien',
             'ausgeschlossene_kategorien': 'Alkohol'
         }))
     assert configuration_provider.get_configuration(
         'AUSGESCHLOSSENE_KATEGORIEN') == 'Alkohol'
コード例 #5
0
 def test_change_themecolor_should_change_partnername(self):
     self.set_up()
     assert configuration_provider.get_configuration(
         'THEME_COLOR') == '#00acd6'
     configuration.index(
         PostRequest({
             'action': 'change_themecolor',
             'themecolor': '#000000'
         }))
     assert configuration_provider.get_configuration(
         'THEME_COLOR') == '#000000'
コード例 #6
0
    def test_change_db_should_trigger_db_reload(self):
        self.set_up()
        configuration.index(
            PostRequest({
                'action': 'edit_databases',
                'dbs': 'test'
            }))
        assert viewcore.database_instance().name == 'test'

        configuration.index(
            PostRequest({
                'action': 'edit_databases',
                'dbs': 'test2'
            }))
        assert viewcore.database_instance().name == 'test2'
コード例 #7
0
    def test_change_partnername_should_mirgrate_old_partnernames(self):
        self.set_up()
        name_of_partner = viewcore.name_of_partner()
        gemeinsame_buchungen = viewcore.database_instance().gemeinsamebuchungen
        gemeinsame_buchungen.add(datum('01.01.2017'), 'kat', 'name', 1,
                                 name_of_partner)

        configuration.index(
            PostRequest({
                'action': 'set_partnername',
                'partnername': 'testpartner_renamed'
            }))
        gemeinsame_buchungen = viewcore.database_instance().gemeinsamebuchungen
        database_partners = gemeinsame_buchungen.content.Person

        assert set(database_partners) == set(['testpartner_renamed'])
コード例 #8
0
 def test_change_colors(self):
     self.set_up()
     assert viewcore.design_colors(
     ) == '3c8dbc,f56954,00a65a,00c0ef,f39c12,d2d6de,001F3F,39CCCC,3D9970,01FF70,FF851B,F012BE,8E24AA,D81B60,222222,d2d6de'.split(
         ',')
     configuration.index(
         PostRequest({
             'action': 'change_colorpalette',
             '0_checked': 'on',
             '0_farbe': '#000000',
             '1_checked': 'on',
             '1_farbe': '#FFFFFF',
             '2_farbe': '#555555'
         }))
     assert viewcore.design_colors() == ['000000', 'FFFFFF']
     self.set_up()
コード例 #9
0
 def test_init(self):
     self.set_up()
     configuration.index(GetRequest())