Exemplo n.º 1
0
def test_add_should_only_fire_once():
    set_up()
    typ_etf = persisted_state.database_instance().depotwerte.TYP_ETF
    next_id = request_handler.current_key()
    add_depotwert.index(PostRequest(
        {'action': 'add',
         'ID': next_id,
         'name': '1name',
         'isin': '1isin',
         'typ': typ_etf
         }
     ))
    add_depotwert.index(PostRequest(
        {'action': 'add',
         'ID': next_id,
         'name': 'overwritten',
         'isin': 'overwritten',
         'typ': ''
         }
     ))
    db = persisted_state.database_instance()
    assert len(db.depotwerte.content) == 1
    assert db.depotwerte.content.Name[0] == '1name'
    assert db.depotwerte.content.ISIN[0] == '1isin'
    assert db.depotwerte.content.Typ[0] == typ_etf
Exemplo n.º 2
0
def test_edit_depotwert():
    set_up()
    add_depotwert.index(VersionedPostRequest(
        {'action': 'add',
         'name': '1name',
         'isin': '1isin'
         }
    ))

    result = add_depotwert.index(VersionedPostRequest(
        {'action': 'add',
         'edit_index': 0,
         'name': '2name',
         'isin': '2isin'
         }
    ))

    db = persisted_state.database_instance()
    assert len(db.depotwerte.content) == 1
    assert db.depotwerte.content.Name[0] == '2name'
    assert db.depotwerte.content.ISIN[0] == '2isin'

    result_element = list(result['letzte_erfassung'])[0]

    assert result_element['fa'] == 'pencil'
    assert result_element['Name'] == '2name'
    assert result_element['Isin'] == '2isin'
Exemplo n.º 3
0
def test_add_shouldAddDepotwert():
    set_up()
    add_depotwert.index(VersionedPostRequest(
        {'action': 'add',
         'name': '1name',
         'isin': '1isin'
         }
     ))

    db = persisted_state.database_instance()
    assert len(db.depotwerte.content) == 1
    assert db.depotwerte.content.Name[0] == '1name'
    assert db.depotwerte.content.ISIN[0] == '1isin'
Exemplo n.º 4
0
def test_edit_call_from_ueberischt_should_preset_values_and_rename_button():
    set_up()
    add_depotwert.index(VersionedPostRequest(
        {'action': 'add',
         'name': '1name',
         'isin': '1isin'
         }
    ))

    context = add_depotwert.index(PostRequest({'action': 'edit', 'edit_index': '0'}))
    assert context['approve_title'] == 'Depotwert aktualisieren'
    preset = context['default_item']

    assert preset['edit_index'] == '0'
    assert preset['name'] == '1name'
    assert preset['isin'] == '1isin'
Exemplo n.º 5
0
def test_edit_depotwert_with_underscrore_should_return_error():
    set_up()
    add_depotwert.index(VersionedPostRequest(
        {'action': 'add',
         'name': '1name',
         'isin': '1isin'
         }
    ))

    result = add_depotwert.index(VersionedPostRequest(
        {'action': 'add',
         'edit_index': 0,
         'name': '2name',
         'isin': '2_isin'
         }
    ))

    assert result['%Errortext'] == 'ISIN darf kein Unterstrich "_" enthalten.'
Exemplo n.º 6
0
def test_edit_call_from_ueberischt_should_preset_values_and_rename_button():
    set_up()
    typ_etf = persisted_state.database_instance().depotwerte.TYP_ETF
    add_depotwert.index(VersionedPostRequest(
        {'action': 'add',
         'name': '1name',
         'isin': '1isin',
         'typ': typ_etf
         }
    ))

    context = add_depotwert.index(PostRequest({'action': 'edit', 'edit_index': '0'}))
    assert context['approve_title'] == 'Depotwert aktualisieren'
    preset = context['default_item']

    assert preset['edit_index'] == '0'
    assert preset['name'] == '1name'
    assert preset['isin'] == '1isin'
    assert preset['typ'] == typ_etf
Exemplo n.º 7
0
def test_edit_depotwert_with_underscrore_should_return_error():
    set_up()
    typ_etf = persisted_state.database_instance().depotwerte.TYP_ETF
    add_depotwert.index(VersionedPostRequest(
        {'action': 'add',
         'name': '1name',
         'isin': '1isin',
         'typ': typ_etf
         }
    ))

    result = add_depotwert.index(VersionedPostRequest(
        {'action': 'add',
         'edit_index': 0,
         'name': '2name',
         'isin': '2_isin',
         'typ': typ_etf
         }
    ))

    assert result['%Errortext'] == 'ISIN darf kein Unterstrich "_" enthalten.'
Exemplo n.º 8
0
def test_edit_depotwert_should_only_fire_once():
    set_up()
    add_depotwert.index(VersionedPostRequest(
        {'action': 'add',
         'name': '1name',
         'isin': '1isin'
         }
    ))

    next_id = request_handler.current_key()
    add_depotwert.index(PostRequest(
        {'action': 'add',
         'ID': next_id,
         'edit_index': 0,
         'name': '2name',
         'isin': '2isin'
         }
    ))
    add_depotwert.index(PostRequest(
        {'action': 'add',
         'ID': next_id,
         'edit_index': 0,
         'name': 'overwritten',
         'isin': 'overwritten'
         }
    ))

    db = persisted_state.database_instance()
    assert len(db.depotwerte.content) == 1
    assert db.depotwerte.content.Name[0] == '2name'
    assert db.depotwerte.content.ISIN[0] == '2isin'
Exemplo n.º 9
0
def test_add_depotwert_should_show_in_recently_added():
    set_up()
    result = add_depotwert.index(VersionedPostRequest(
        {'action': 'add',
         'name': '1name',
         'isin': '1isin'
         }
     ))
    result_element = list(result['letzte_erfassung'])[0]

    assert result_element['fa'] == 'plus'
    assert result_element['Name'] == '1name'
    assert result_element['Isin'] == '1isin'
Exemplo n.º 10
0
def test_add_depotwert_should_show_in_recently_added():
    set_up()
    typ_etf = persisted_state.database_instance().depotwerte.TYP_ETF
    result = add_depotwert.index(VersionedPostRequest(
        {'action': 'add',
         'name': '1name',
         'isin': '1isin',
         'typ': typ_etf
         }
     ))
    result_element = list(result['letzte_erfassung'])[0]

    assert result_element['fa'] == 'plus'
    assert result_element['Name'] == '1name'
    assert result_element['Isin'] == '1isin'
    assert result_element['Typ'] == typ_etf
Exemplo n.º 11
0
def display_add_depowert():
    return add_depotwert.index(request)
Exemplo n.º 12
0
def test_transaction_id_should_be_in_context():
    set_up()
    context = add_depotwert.index(GetRequest())
    assert 'ID' in context
Exemplo n.º 13
0
def test_init():
    set_up()
    context = add_depotwert.index(GetRequest())
    assert context['approve_title'] == 'Depotwert hinzufügen'
Exemplo n.º 14
0
def test_init():
    set_up()
    context = add_depotwert.index(GetRequest())
    assert context['approve_title'] == 'Depotwert hinzufügen'
    assert context['types'] == persisted_state.database_instance().depotwerte.TYPES