def test_delete_einzelbuchhungen():
    requester.INSTANCE = RequesterStub(
        {'https://test.test/deleteitems.php': 'ok'})

    delete_einzelbuchungen('https://test.test',
                           auth_container=OnlineAuth(None, None, None))

    assert requester.INSTANCE.call_count_of(
        'https://test.test/deleteitems.php') == 1
Beispiel #2
0
def test_upload_gemeinsame_buchungen():
    api_url = 'https://test.test/api/gemeinsamebuchung.php'
    data = ['Gemeinsame Buchungen']
    requester.INSTANCE = RequesterStub({api_url: _RESULT_OK}, auth_cookies='auth_cookies')

    result = upload_gemeinsame_buchungen('https://test.test/api', data, OnlineAuth('', '', 'auth_cookies'))

    assert result
    assert requester.INSTANCE.data_of_request(api_url) == [data]
def test_import_einzelbuchungen():
    requester.INSTANCE = RequesterStub(
        {'https://test.test/einzelbuchung.php': _JSON_IMPORT_DATA})

    result = get_einzelbuchungen('https://test.test',
                                 auth_container=OnlineAuth(None, None, None))

    assert result[0]["id"] == "122"
    assert result[0]["name"] == "Testausgabe1"
    assert result[1]["id"] == "123"
    assert result[1]["name"] == "Testausgabe2"
Beispiel #4
0
def test_get_gemeinsame_buchungen():
    requester.INSTANCE = RequesterStub({'https://test.test/api/gemeinsamebuchung.php': _JSON_IMPORT_DATA})

    result = get_gemeinsame_buchungen('https://test.test/api', OnlineAuth(None, None, None))

    assert result[0]["id"] == "122"
    assert result[0]["name"] == "Testausgabe1"
    assert result[0]["user"] == "Sebastian"
    assert result[0]["zielperson"] == "Sebastian"
    assert result[1]["id"] == "123"
    assert result[1]["name"] == "Testausgabe2"
    assert result[1]["user"] == "other"
    assert result[1]["zielperson"] == "other"
Beispiel #5
0
def test_set_kategorien():
    requester.INSTANCE = RequesterStub(
        {'https://test.test/setkategorien.php': 'ok'})

    set_kategorien('https://test.test',
                   'kategorie1,kategorie2',
                   auth_container=OnlineAuth(None, None, None))

    assert requester.INSTANCE.call_count_of(
        'https://test.test/setkategorien.php') == 1
    assert requester.INSTANCE.data_of_request(
        'https://test.test/setkategorien.php') == [{
            'kategorien':
            'kategorie1,kategorie2'
        }]
Beispiel #6
0
def test_get_partnername():
    requester.INSTANCE = RequesterStub(
        {'https://test.test/api/partner.php': partnername_response})

    assert get_partnername('https://test.test/api',
                           OnlineAuth(None, None, None)) == 'Partner1'