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'
def test_addKategorie(self): self.set_up() configuration.index( PostRequest({ 'action': 'add_kategorie', 'neue_kategorie': 'test' })) assert database_instance().einzelbuchungen.get_alle_kategorien( ) == set(['test'])
def test_change_themecolor_should_change_themecolor(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'
def test_change_schliesse_kateorien_aus_should_change_add_ausgeschlossene_kategorien( 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'
def test_change_db_should_trigger_db_reload(self): self.set_up() configuration.index( PostRequest({ 'action': 'edit_databases', 'dbs': 'test' })) assert database_instance().name == 'test' configuration.index( PostRequest({ 'action': 'edit_databases', 'dbs': 'test2' })) assert database_instance().name == 'test2'
def test_change_partnername_should_mirgrate_old_partnernames(self): self.set_up() name_of_partner = viewcore.name_of_partner() gemeinsame_buchungen = 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 = database_instance().gemeinsamebuchungen database_partners = gemeinsame_buchungen.content.Person assert set(database_partners) == set(['testpartner_renamed'])
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()
def test_set_kategorien_with_ausgeschlossene_kategoerien_should_hide_ausgeschlossene_kategorien( ): set_up() database_instance().einzelbuchungen.add(datum('20.01.1990'), 'JaEins', 'SomeTitle', -10) database_instance().einzelbuchungen.add(datum('20.01.1990'), 'NeinEins', 'SomeTitle', -10) 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': '', 'https://test.test/login.php': LOGIN_RESPONSE }, DECODED_LOGIN_DATA, auth_cookies=LOGIN_COOKIES) result = import_data.index( PostRequest({ 'action': 'set_kategorien', 'email': '', 'server': 'test.test', 'password': '' })) assert result['message'] assert result['message_type'] == 'success' assert result[ 'message_content'] == 'Kategorien erfolgreich in die Online-Version übertragen.' assert requester.instance().data_of_request( 'https://test.test/setkategorien.php' )[0]['kategorien'] == 'JaEins,JaZwei'
def test_transaction_id_should_be_in_context(self): self.set_up() context = configuration.index(GetRequest()) assert 'ID' in context
def test_init(self): self.set_up() configuration.index(GetRequest())
def view_configuration(): return configuration.index(request)