analytics: collect and send on daemon

This commit is contained in:
Mr. Outis
2019-12-02 22:54:16 -06:00
parent 8b5ca253ec
commit 8a32b28b54
5 changed files with 21 additions and 34 deletions
+2 -6
View File
@@ -1,4 +1,3 @@
import json
import pytest
import mock
@@ -40,12 +39,9 @@ def test_collect(tmp_global_config):
def test_send(mock_post, tmp_path):
url = "https://analytics.dvc.org"
report = {"name": "dummy report"}
fname = tmp_path / "report"
fname.write_text(str(json.dumps(report)))
analytics.send(fname)
assert mock_post.called
assert mock_post.call_args.args[0] == url
analytics.send(report)
mock_post.assert_called_with(url, json=report, timeout=5)
@pytest.mark.parametrize(