From fb6a31a3779b8c050280906efb3af0cad088246f Mon Sep 17 00:00:00 2001 From: Luna Mendes Date: Tue, 13 Nov 2018 02:53:53 -0300 Subject: [PATCH] tests: add test_no_tracking.py --- tests/test_no_tracking.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/test_no_tracking.py diff --git a/tests/test_no_tracking.py b/tests/test_no_tracking.py new file mode 100644 index 0000000..e8d3033 --- /dev/null +++ b/tests/test_no_tracking.py @@ -0,0 +1,37 @@ +import pytest + +from tests.common import login + + +@pytest.mark.asyncio +async def test_science_empty(test_cli): + """Test that the science route gives nothing.""" + resp = await test_cli.post('/api/v6/science') + assert resp.status_code == 204 + + +@pytest.mark.asyncio +async def test_harvest_empty(test_cli): + """test that the harvest route is empty""" + resp = await test_cli.get('/api/v6/users/@me/harvest') + assert resp.status_code == 204 + + +@pytest.mark.asyncio +async def test_consent_non_consenting(test_cli): + """Test the consent route to see if we're still on + a non-consent status regarding data collection.""" + token = await login('normal', test_cli) + + resp = await test_cli.get('/api/v6/users/@me/consent', headers={ + 'Authorization': token + }) + + assert resp.status_code == 200 + + rjson = await resp.json + assert isinstance(rjson, dict) + + # assert that we did not consent to those + assert not rjson['usage_statistics']['consented'] + assert not rjson['personalization']['consented']