Skip to content

Commit 9eac1a4

Browse files
authored
Fixed CI tests for master branch (#235)
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
1 parent a49f7ea commit 9eac1a4

File tree

3 files changed

+38
-54
lines changed

3 files changed

+38
-54
lines changed

tests/actual_tests/files_test.py

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,51 +1055,49 @@ async def test_trashbin_async(anc_any, file_path):
10551055
assert not r
10561056

10571057

1058-
@pytest.mark.parametrize(
1059-
"dest_path",
1060-
("/test_dir_tmp/file_versions.txt", "/test_dir_tmp/file_versions-ä.txt", "test_dir_tmp/file_versions-1##3"),
1061-
)
1062-
def test_file_versions(nc_any, dest_path):
1058+
@pytest.mark.parametrize("update_by_id", (False, True))
1059+
def test_file_versions(nc_any, update_by_id):
10631060
if nc_any.check_capabilities("files.versioning"):
10641061
pytest.skip("Need 'Versions' App to be enabled.")
1065-
for i in (0, 1):
1066-
nc_any.files.delete(dest_path, not_fail=True)
1067-
nc_any.files.upload(dest_path, content=b"22")
1068-
new_file = nc_any.files.upload(dest_path, content=b"333")
1069-
if i:
1070-
new_file = nc_any.files.by_id(new_file)
1071-
versions = nc_any.files.get_versions(new_file)
1072-
assert versions
1073-
version_str = str(versions[0])
1074-
assert version_str.find("File version") != -1
1075-
assert version_str.find("bytes size") != -1
1076-
nc_any.files.restore_version(versions[0])
1077-
time.sleep(0.5)
1078-
assert nc_any.files.download(new_file) == b"22"
1062+
dest_path = "/test_dir_tmp/file_versions-ä.txt"
1063+
nc_any.files.delete(dest_path, not_fail=True)
1064+
nc_any.files.upload(dest_path, content=b"22")
1065+
time.sleep(2.0)
1066+
new_file = nc_any.files.upload(dest_path, content=b"333")
1067+
if update_by_id:
1068+
new_file = nc_any.files.by_id(new_file)
1069+
versions = nc_any.files.get_versions(new_file)
1070+
assert versions
1071+
version_str = str(versions[0])
1072+
assert version_str.find("File version") != -1
1073+
assert version_str.find("bytes size") != -1
1074+
time.sleep(2.0)
1075+
nc_any.files.restore_version(versions[0])
1076+
time.sleep(2.0)
1077+
assert nc_any.files.download(new_file) == b"22"
10791078

10801079

10811080
@pytest.mark.asyncio(scope="session")
1082-
@pytest.mark.parametrize(
1083-
"dest_path",
1084-
("/test_dir_tmp/file_versions.txt", "/test_dir_tmp/file_versions-ä.txt", "test_dir_tmp/file_versions-1##3"),
1085-
)
1086-
async def test_file_versions_async(anc_any, dest_path):
1081+
@pytest.mark.parametrize("update_by_id", (False, True))
1082+
async def test_file_versions_async(anc_any, update_by_id):
10871083
if await anc_any.check_capabilities("files.versioning"):
10881084
pytest.skip("Need 'Versions' App to be enabled.")
1089-
for i in (0, 1):
1090-
await anc_any.files.delete(dest_path, not_fail=True)
1091-
await anc_any.files.upload(dest_path, content=b"22")
1092-
new_file = await anc_any.files.upload(dest_path, content=b"333")
1093-
if i:
1094-
new_file = await anc_any.files.by_id(new_file)
1095-
versions = await anc_any.files.get_versions(new_file)
1096-
assert versions
1097-
version_str = str(versions[0])
1098-
assert version_str.find("File version") != -1
1099-
assert version_str.find("bytes size") != -1
1100-
await anc_any.files.restore_version(versions[0])
1101-
time.sleep(0.5)
1102-
assert await anc_any.files.download(new_file) == b"22"
1085+
dest_path = "/test_dir_tmp/file_versions-ä-async.txt"
1086+
await anc_any.files.delete(dest_path, not_fail=True)
1087+
await anc_any.files.upload(dest_path, content=b"22")
1088+
time.sleep(2.0)
1089+
new_file = await anc_any.files.upload(dest_path, content=b"333")
1090+
if update_by_id:
1091+
new_file = await anc_any.files.by_id(new_file)
1092+
versions = await anc_any.files.get_versions(new_file)
1093+
assert versions
1094+
version_str = str(versions[0])
1095+
assert version_str.find("File version") != -1
1096+
assert version_str.find("bytes size") != -1
1097+
time.sleep(2.0)
1098+
await anc_any.files.restore_version(versions[0])
1099+
time.sleep(2.0)
1100+
assert await anc_any.files.download(new_file) == b"22"
11031101

11041102

11051103
def test_create_update_delete_tag(nc_any):

tests/actual_tests/user_status_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ async def test_set_status_type_async(anc, value):
173173
assert r.status_type_defined
174174

175175

176-
@pytest.mark.parametrize("clear_at", (None, int(time()) + 360))
176+
@pytest.mark.parametrize("clear_at", (None, int(time()) + 60 * 60 * 9))
177177
def test_set_predefined(nc, clear_at):
178178
if nc.srv_version["major"] < 27:
179179
nc.user_status.set_predefined("meeting")
@@ -189,7 +189,7 @@ def test_set_predefined(nc, clear_at):
189189

190190

191191
@pytest.mark.asyncio(scope="session")
192-
@pytest.mark.parametrize("clear_at", (None, int(time()) + 360))
192+
@pytest.mark.parametrize("clear_at", (None, int(time()) + 60 * 60 * 9))
193193
async def test_set_predefined_async(anc, clear_at):
194194
if (await anc.srv_version)["major"] < 27:
195195
await anc.user_status.set_predefined("meeting")

tests/actual_tests/weather_status_test.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ def test_get_set_location(nc_any):
3838
if loc.address.find("Unknown") != -1:
3939
pytest.skip("Some network problem on the host")
4040
assert loc.address.find("Rom") != -1
41-
assert nc_any.weather_status.set_location(latitude=41.896655, longitude=12.488776, address="Paris, France")
42-
loc = nc_any.weather_status.get_location()
43-
assert loc.latitude == 41.896655
44-
assert loc.longitude == 12.488776
45-
if loc.address.find("Unknown") != -1:
46-
pytest.skip("Some network problem on the host")
47-
assert loc.address.find("Rom") != -1
4841

4942

5043
@pytest.mark.asyncio(scope="session")
@@ -74,13 +67,6 @@ async def test_get_set_location_async(anc_any):
7467
if loc.address.find("Unknown") != -1:
7568
pytest.skip("Some network problem on the host")
7669
assert loc.address.find("Rom") != -1
77-
assert await anc_any.weather_status.set_location(latitude=41.896655, longitude=12.488776, address="Paris, France")
78-
loc = await anc_any.weather_status.get_location()
79-
assert loc.latitude == 41.896655
80-
assert loc.longitude == 12.488776
81-
if loc.address.find("Unknown") != -1:
82-
pytest.skip("Some network problem on the host")
83-
assert loc.address.find("Rom") != -1
8470

8571

8672
def test_get_set_location_no_lat_lon_address(nc):

0 commit comments

Comments
 (0)