aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2022-07-17 21:01:41 +0200
committerDaniel Schadt <kingdread@gmx.de>2022-07-17 21:01:41 +0200
commit333a06478b40d2e1b0f2243745807c745005233a (patch)
tree85de8e610c32876b7e7cff487506526ead2a7992 /tests/unit
parenta07ca7c0b7e567f2647d13f84db6aed201cde56c (diff)
parent69c9167911a8449fef20951abe924a1c4528545c (diff)
downloadfietsboek-333a06478b40d2e1b0f2243745807c745005233a.tar.gz
fietsboek-333a06478b40d2e1b0f2243745807c745005233a.tar.bz2
fietsboek-333a06478b40d2e1b0f2243745807c745005233a.zip
Merge branch 'multi-download'
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test_util.py8
-rw-r--r--tests/unit/views/test_browse.py14
2 files changed, 16 insertions, 6 deletions
diff --git a/tests/unit/test_util.py b/tests/unit/test_util.py
index e63bd01..debf229 100644
--- a/tests/unit/test_util.py
+++ b/tests/unit/test_util.py
@@ -1,11 +1,10 @@
-import gzip
from datetime import timedelta
-from pathlib import Path
import pytest
import gpxpy
from markupsafe import Markup
+from testutils import load_gpx_asset
from fietsboek import util
@@ -59,10 +58,7 @@ def test_round_timedelta_to_multiple(delta, multiple, expected):
("Teasi_1.gpx.gz", timedelta(hours=2)),
])
def test_guess_gpx_timezone(gpx_file, offset):
- asset_dir = Path(__file__).parent.parent / 'assets'
- test_file = asset_dir / gpx_file
- with gzip.open(test_file, 'rb') as fobj:
- parsed_gpx = gpxpy.parse(fobj)
+ parsed_gpx = gpxpy.parse(load_gpx_asset(gpx_file))
timezone = util.guess_gpx_timezone(parsed_gpx)
# Here we hope (and assume) that utcoffset is ignored. This is true for
# datetime.timezone objects, but may not be for other datetime.tzinfo
diff --git a/tests/unit/views/test_browse.py b/tests/unit/views/test_browse.py
new file mode 100644
index 0000000..93eb0ae
--- /dev/null
+++ b/tests/unit/views/test_browse.py
@@ -0,0 +1,14 @@
+from fietsboek.views.browse import Stream
+
+
+class TestStream:
+ def test_write(self):
+ stream = Stream()
+ n = stream.write(b"foobar")
+ assert n == 6
+
+ def test_write_read(self):
+ stream = Stream()
+ stream.write(b"foo")
+ stream.write(b"bar")
+ assert stream.readall() == b"foobar"