Пример #1
0
def set_up():
    file_system.INSTANCE = FileSystemStub()
    persisted_state.DATABASE_INSTANCE = None
    persisted_state.DATABASES = []
    configuration_provider.set_configuration('PARTNERNAME', 'Partner')
    configuration_provider.set_configuration('DATABASES', 'TestUser')
    request_handler.stub_me()
Пример #2
0
def test_load_data_filled():
    file_system.INSTANCE = FileSystemStub()
    file_system.instance().write(SHARES_PATH, '{"demo": 1234}')

    result = load_data()

    assert result.content == {'demo': 1234}
Пример #3
0
def set_up():
    file_system.INSTANCE = FileSystemStub()
    persisted_state.DATABASE_INSTANCE = None
    depotwerte = persisted_state.database_instance().depotwerte
    persisted_state.database_instance().sparkontos.add('1demokonto',
                                                       Kontos.TYP_DEPOT)
    persisted_state.database_instance().sparkontos.add('2demokonto',
                                                       Kontos.TYP_DEPOT)
    depotwerte.add(name='1demowert', isin='1demoisin', typ=depotwerte.TYP_ETF)
    depotwerte.add(name='2demowert', isin='2demoisin', typ=depotwerte.TYP_ETF)
    depotwerte.add(name='3demowert', isin='3demoisin', typ=depotwerte.TYP_ETF)

    # old depotauszug, alle isins gebucht
    persisted_state.database_instance().depotauszuege.add(
        datum('01.01.2020'), '1demoisin', '1demokonto', 1)
    persisted_state.database_instance().depotauszuege.add(
        datum('01.01.2020'), '2demoisin', '1demokonto', 1)
    persisted_state.database_instance().depotauszuege.add(
        datum('01.01.2020'), '3demoisin', '1demokonto', 1)
    persisted_state.database_instance().depotauszuege.add(
        datum('01.01.2020'), '1demoisin', '2demokonto', 1)
    persisted_state.database_instance().depotauszuege.add(
        datum('01.01.2020'), '2demoisin', '2demokonto', 1)
    persisted_state.database_instance().depotauszuege.add(
        datum('01.01.2020'), '3demoisin', '2demokonto', 1)

    # new depotauszug
    persisted_state.database_instance().depotauszuege.add(
        datum('02.01.2020'), '1demoisin', '1demokonto', 20)
    persisted_state.database_instance().depotauszuege.add(
        datum('02.01.2020'), '2demoisin', '2demokonto', 30)
    persisted_state.database_instance().depotauszuege.add(
        datum('02.01.2020'), '3demoisin', '2demokonto', 40)

    request_handler.stub_me()
Пример #4
0
 def set_up(self):
     file_system.INSTANCE = FileSystemStub()
     persisted_state.DATABASE_INSTANCE = None
     depotwerte = persisted_state.database_instance().depotwerte
     persisted_state.database_instance().sparkontos.add('demokonto', Kontos.TYP_DEPOT)
     depotwerte.add(name='demowert', isin='demoisin', typ=depotwerte.TYP_ETF)
     request_handler.stub_me()
Пример #5
0
 def set_up(self):
     file_system.INSTANCE = FileSystemStub()
     configuration_provider.LOADED_CONFIG = None
     persisted_state.DATABASE_INSTANCE = None
     persisted_state.DATABASES = []
     time.stub_today_with(datum('01.01.2019'))
     configuration_provider.set_configuration('PARTNERNAME', 'Partner')
     request_handler.stub_me()
Пример #6
0
def test_save_if_needed():
    file_system.INSTANCE = FileSystemStub()
    shares_info = SharesInfo({})
    shares_info.save('isin', '2021-01-01', 'test_data', {'demo': 'data'})

    save_if_needed(shares_info)

    assert file_system.INSTANCE.read(SHARES_PATH) == [
        '{"isin": {"data": [{"date": "2021-01-01", "data": {"demo": "data"}, "source": "test_data"}]}}'
    ]
Пример #7
0
def enter_testmode(request):
    file_system.INSTANCE = FileSystemStub()
    persisted_state.DATABASE_INSTANCE = None
    persisted_state.DATABASES = ['test']
    non_persisted_state.CONTEXT = {}
    configuration_provider.LOADED_CONFIG = None
    configuration_provider.set_configuration('PARTNERNAME', 'Partner')
    time.stub_today_with(datum('22.01.2019'))
    print('WARNUNG: ENTERING TESTMODE')
    return redirect('/', code=301)
    def set_up(self):
        file_system.INSTANCE = FileSystemStub()
        file_system.instance().write(
            file_system.ABRECHNUNG_PATH + '*Abrechnung_A',
            self.ABRECHNUNG_A_CONTENT)
        file_system.instance().write(file_system.IMPORT_PATH + '*Import_A',
                                     self.IMPORT_A_CONTENT)

        persisted_state.DATABASE_INSTANCE = None
        request_handler.stub_me()
Пример #9
0
    def test_alle_abrechnungen(self):
        file_system.INSTANCE = FileSystemStub()
        file_system.instance().write(file_system.ABRECHNUNG_PATH+'*Abrechnung_A', 'content abrechnung a')
        file_system.instance().write(file_system.IMPORT_PATH+'*Import_A', 'content import a')

        abrechnungen = file_system.all_abrechnungen()

        assert abrechnungen == [
                                 {
                                     'content': ['content abrechnung a'],
                                     'name': '../Abrechnungen/*Abrechnung_A'
                                 },
                                 {
                                     'content': ['content import a'],
                                     'name': '../Import/*Import_A'
                                 }
                              ]
Пример #10
0
 def set_up(self):
     file_system.INSTANCE = FileSystemStub()
     persisted_state.DATABASE_INSTANCE = None
     request_handler.stub_me()
Пример #11
0
 def mock_filesystem(self):
     file_system.INSTANCE = FileSystemStub()
Пример #12
0
 def set_up(self):
     file_system.INSTANCE = FileSystemStub()
     persisted_state.DATABASE_INSTANCE = None
     configuration_provider.LOADED_CONFIG = None
     request_handler.stub_me()
Пример #13
0
 def set_up(self):
     file_system.INSTANCE = FileSystemStub()
     persisted_state.DATABASE_INSTANCE = None
     persisted_state.database_instance()
     request_handler.stub_me_theme()
Пример #14
0
def test_save_if_needed_with_no_changes():
    file_system.INSTANCE = FileSystemStub()

    save_if_needed(SharesInfo({}))

    assert not file_system.INSTANCE.get_interaction_count()
Пример #15
0
def test_load_data_empty():
    file_system.INSTANCE = FileSystemStub()

    result = load_data()

    assert not result.content
Пример #16
0
 def set_up(self):
     file_system.INSTANCE = FileSystemStub()
     persisted_state.DATABASE_INSTANCE = None
     persisted_state.DATABASES = []
     configuration_provider.set_configuration('PARTNERNAME', 'Partner')
 def set_up(self):
     file_system.INSTANCE = FileSystemStub()
     configuration_provider.LOADED_CONFIG = None
Пример #18
0
 def set_up(self):
     file_system.INSTANCE = FileSystemStub()
     persisted_state.DATABASE_INSTANCE = None
     persisted_state.database_instance().sparkontos.add(
         'demokonto', Kontos.TYP_SPARKONTO)
     request_handler.stub_me()