Skip to content

Commit

Permalink
Update tests for the /plot/<metric> route:
Browse files Browse the repository at this point in the history
+ separate out test_plot_with_data to '_by_name' and '_by_id'
+ Remove skipped test - replaced by new ones. (which are also skipped...
  but now I have a better reason for it!)
  • Loading branch information
dougthor42 committed May 14, 2019
1 parent b96957c commit f23bf95
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tests/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,28 @@ def test_index_with_data(client, populated_db):
assert b"foo.bar" in rv.data


@pytest.mark.xfail(reason="Needs code updates")
def test_plot(client):
rv = client.get("/plot/foo")
assert rv.status_code == 404


def test_plot_with_data(client, populated_db):
@pytest.mark.xfail(
reason="JS callbacks are async: plotly div not populated immediatly"
)
def test_plot_with_data_by_name(client, populated_db):
rv = client.get("/plot/foo")
assert rv.status_code == 200
assert b"foo" in rv.data
assert b'<div id="graph"' in rv.data
# TODO: make this work. Issue is JS callbacks.
# assert b'<div class="plot-container plotly">' in rv.data


@pytest.mark.xfail(
reason="JS callbacks are async: plotly div not populated immediatly"
)
def test_plot_with_data_by_id(client, populated_db):
rv = client.get("/plot/1")
assert rv.status_code == 200
assert b"foo" in rv.data
assert b'<div id="graph"' in rv.data
# TODO: make this work. Issue is JS callbacks.
# assert b'<div class="plot-container plotly">' in rv.data


def test_api_add(client):
Expand Down

0 comments on commit f23bf95

Please sign in to comment.