e545343cd3783b688dba7d1ec2fdc9088100ba99
4 from osm_common
.fsbase
import FsBase
, FsException
7 def exception_message(message
):
8 return "storage exception " + message
16 def test_constructor():
18 assert fs_base
is not None
19 assert isinstance(fs_base
, FsBase
)
22 def test_get_params(fs_base
):
23 params
= fs_base
.get_params()
24 assert isinstance(params
, dict)
25 assert len(params
) == 0
28 def test_fs_connect(fs_base
):
29 fs_base
.fs_connect(None)
32 def test_fs_disconnect(fs_base
):
33 fs_base
.fs_disconnect()
36 def test_mkdir(fs_base
):
37 with pytest
.raises(FsException
) as excinfo
:
39 assert str(excinfo
.value
).startswith(exception_message("Method 'mkdir' not implemented"))
40 assert excinfo
.value
.http_code
== http
.HTTPStatus
.INTERNAL_SERVER_ERROR
43 def test_file_exists(fs_base
):
44 with pytest
.raises(FsException
) as excinfo
:
45 fs_base
.file_exists(None)
46 assert str(excinfo
.value
).startswith(exception_message("Method 'file_exists' not implemented"))
47 assert excinfo
.value
.http_code
== http
.HTTPStatus
.INTERNAL_SERVER_ERROR
50 def test_file_size(fs_base
):
51 with pytest
.raises(FsException
) as excinfo
:
52 fs_base
.file_size(None)
53 assert str(excinfo
.value
).startswith(exception_message("Method 'file_size' not implemented"))
54 assert excinfo
.value
.http_code
== http
.HTTPStatus
.INTERNAL_SERVER_ERROR
57 def test_file_extract(fs_base
):
58 with pytest
.raises(FsException
) as excinfo
:
59 fs_base
.file_extract(None, None)
60 assert str(excinfo
.value
).startswith(exception_message("Method 'file_extract' not implemented"))
61 assert excinfo
.value
.http_code
== http
.HTTPStatus
.INTERNAL_SERVER_ERROR
64 def test_file_open(fs_base
):
65 with pytest
.raises(FsException
) as excinfo
:
66 fs_base
.file_open(None, None)
67 assert str(excinfo
.value
).startswith(exception_message("Method 'file_open' not implemented"))
68 assert excinfo
.value
.http_code
== http
.HTTPStatus
.INTERNAL_SERVER_ERROR
71 def test_file_delete(fs_base
):
72 with pytest
.raises(FsException
) as excinfo
:
73 fs_base
.file_delete(None, None)
74 assert str(excinfo
.value
).startswith(exception_message("Method 'file_delete' not implemented"))
75 assert excinfo
.value
.http_code
== http
.HTTPStatus
.INTERNAL_SERVER_ERROR