Exemplo n.º 1
0
def test_cannot_preview_nonexisting_post(postsetup):
    postsetup.login()
    r = postsetup.app.get('/1/edit')
    token = get_token(r.data)
    r = edit_post(postsetup, token, url='/2/edit', action='preview')

    assert r.status_code == 404
    assert 'That post does not exist.' in r.data
    postsetup.done()
Exemplo n.º 2
0
def test_cannot_edit_nonexisting_tag(tagsetup):
    tagsetup.login()
    r = tagsetup.app.get('/tags/1/edit')
    token = get_token(r.data)
    r = edit_tag(tagsetup, token, url='/tags/2/edit')

    assert r.status_code == 404
    assert 'That tag does not exist.' in r.data
    tagsetup.done()
Exemplo n.º 3
0
def test_anonymous_cannot_preview_post(postsetup):
    postsetup.login()
    r = postsetup.app.get('/1/edit')
    token = get_token(r.data)
    postsetup.app.get('/logout')
    r = edit_post(postsetup, token)

    assert r.status_code == 403
    assert 'You need to be logged in to view that content' in r.data

    postsetup.done()
Exemplo n.º 4
0
def test_admin_can_edit_tag(tagsetup):
    tagsetup.login()
    r = tagsetup.app.get('/tags/1/edit')
    token = get_token(r.data)
    name = 'name-{0}'.format(token)

    r = edit_tag(tagsetup, token, name=name)

    assert r.status_code == 200
    assert name in r.data
    assert 'Success' in r.data
    tagsetup.done()
Exemplo n.º 5
0
def test_admin_can_preview_post(postsetup):
    postsetup.login()
    r = postsetup.app.get('/1/edit')
    token = get_token(r.data)
    title = 'title-{0}'.format(token)

    r = edit_post(postsetup, token, title=title, action='preview')

    assert r.status_code == 200
    assert '<article>' in r.data
    assert title in r.data
    postsetup.done()
Exemplo n.º 6
0
def test_admin_can_edit_post(postsetup):
    postsetup.login()
    r = postsetup.app.get('/1/edit')
    token = get_token(r.data)
    title = 'title-{0}'.format(token)

    r = edit_post(postsetup, token, title=title)

    assert r.status_code == 200
    assert title in r.data
    assert 'Success' in r.data
    postsetup.done()
Exemplo n.º 7
0
def test_anonymous_cannot_edit_tag(tagsetup):
    tagsetup.login()
    r = tagsetup.app.get('/tags/1/edit')
    token = get_token(r.data)
    tagsetup.app.get('/logout')
    name = 'name-{0}'.format(token)
    r = edit_tag(tagsetup, token, name=name)

    assert r.status_code == 403
    assert 'You need to be logged in to view that content' in r.data

    r = tagsetup.app.get('/tags/')
    assert name not in r.data
    tagsetup.done()
Exemplo n.º 8
0
def test_anonymous_cannot_edit_post(postsetup):
    postsetup.login()
    r = postsetup.app.get('/1/edit')
    token = get_token(r.data)
    postsetup.app.get('/logout')
    title = 'title-{0}'.format(token)
    r = edit_post(postsetup, token, title=title)

    assert r.status_code == 403
    assert 'You need to be logged in to view that content' in r.data

    r = postsetup.app.get('/')
    assert title not in r.data
    postsetup.done()
Exemplo n.º 9
0
        cache_only=True,
    )

    assert len(data) != 0

    validate_data_range(data=data, start_date=start_date, end_date=end_date)


HIST_PROVIDERS = [YahooHistoricalProvider()]

if can_test_iex():
    from algotradepy.historical.providers.iex_provider import (
        IEXHistoricalProvider,
    )

    HIST_PROVIDERS.append(IEXHistoricalProvider(get_token(name="iex")))

if can_test_polygon():
    from algotradepy.historical.providers.polygon_provider import (
        PolygonHistoricalProvider,
    )

    HIST_PROVIDERS.append(PolygonHistoricalProvider(get_token(name="polygon")))

if can_test_ib():
    from algotradepy.historical.providers.ib_provider import (
        IBHistoricalProvider,
    )

    HIST_PROVIDERS.append(IBHistoricalProvider())