Skip to content

Commit 35e350f

Browse files
committed
add test
1 parent 7f8d27e commit 35e350f

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed

mergin/test/test_client.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,3 +2003,28 @@ def test_clean_diff_files(mc):
20032003
diff_files = glob.glob("*-diff-*", root_dir=os.path.split(mp.fpath_meta("inserted_1_A.gpkg"))[0])
20042004

20052005
assert diff_files == []
2006+
2007+
2008+
def test_project_metadata(mc):
2009+
test_project = "test_project_metadata"
2010+
project = API_USER + "/" + test_project
2011+
project_dir = os.path.join(TMP_DIR, test_project)
2012+
2013+
cleanup(mc, project, [project_dir])
2014+
# prepare local project
2015+
shutil.copytree(TEST_DATA_DIR, project_dir)
2016+
2017+
# create remote project
2018+
mc.create_project_and_push(test_project, directory=project_dir)
2019+
2020+
# copy metadata in old format
2021+
project_metadata = os.path.join(project_dir, ".mergin", "mergin.json")
2022+
old_metadata = os.path.join(project_dir, "old_metadata.json")
2023+
shutil.copyfile(old_metadata, project_metadata)
2024+
2025+
# verify we have correct metadata
2026+
mp = MerginProject(project_dir)
2027+
assert mp.project_full_name() == f"{API_USER}/{test_project}"
2028+
assert mp.project_name() == test_project
2029+
assert mp.workspace_name() == API_USER
2030+
assert mp.version() == "v1"
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"name": "test_plugin/test_project_metadata",
3+
"version": "v1",
4+
"project_id": "46e0a252-eb74-456c-9a64-b21d3fba59d6",
5+
"files": [
6+
{
7+
"checksum": "b3426f7d02643c1e0b24d738eee7a54f1c74eca4",
8+
"mtime": "2023-10-12T06:38:49.314490Z",
9+
"path": "two_tables_drop.gpkg",
10+
"size": 118784
11+
},
12+
{
13+
"checksum": "67e64b55b36e945df8c97afc46ff64acfe46b32a",
14+
"mtime": "2023-10-12T06:38:49.314496Z",
15+
"path": "base.gpkg",
16+
"size": 98304
17+
},
18+
{
19+
"checksum": "38662e5645cd0a80009d43fd0f32db79dffabafa",
20+
"mtime": "2023-10-12T06:38:49.314497Z",
21+
"path": "test.txt",
22+
"size": 13
23+
},
24+
{
25+
"checksum": "4973d10c6350604fe5347a11c7d2c59fb06a36e1",
26+
"mtime": "2023-10-12T06:38:49.314497Z",
27+
"path": "inserted_1_A_mod.gpkg",
28+
"size": 98304
29+
},
30+
{
31+
"checksum": "a191cd1dc405642b70f3525f638e1cf8d1052828",
32+
"mtime": "2023-10-12T06:38:49.314498Z",
33+
"path": "two_tables.gpkg",
34+
"size": 118784
35+
},
36+
{
37+
"checksum": "38662e5645cd0a80009d43fd0f32db79dffabafa",
38+
"mtime": "2023-10-12T06:38:49.314499Z",
39+
"path": "test3.txt",
40+
"size": 13
41+
},
42+
{
43+
"checksum": "da39a3ee5e6b4b0d3255bfef95601890afd80709",
44+
"mtime": "2023-10-12T06:38:49.314499Z",
45+
"path": "test.qgs",
46+
"size": 0
47+
},
48+
{
49+
"checksum": "473501ebd51a3ade52f07d8e6c3887bcf2d7803f",
50+
"mtime": "2023-10-12T06:38:49.314500Z",
51+
"path": "two_tables_1_A.gpkg",
52+
"size": 118784
53+
},
54+
{
55+
"checksum": "fa2a379a0626b9505ba61f85d207ad66e9548f83",
56+
"mtime": "2023-10-12T06:38:49.314501Z",
57+
"path": "inserted_1_A.gpkg",
58+
"size": 98304
59+
},
60+
{
61+
"checksum": "763598af125e24c25db319d688d1b7275aae6d58",
62+
"mtime": "2023-10-12T06:38:49.314501Z",
63+
"path": "inserted_1_B.gpkg",
64+
"size": 98304
65+
},
66+
{
67+
"checksum": "aca1d870a2aca068ce360f51c2eb1fc0d08a23cc",
68+
"mtime": "2023-10-12T06:38:49.314502Z",
69+
"path": "test_dir/modified_1_geom.gpkg",
70+
"size": 98304
71+
},
72+
{
73+
"checksum": "dc0c460d742019ca818f1d74c2bc8fbc28d3ad68",
74+
"mtime": "2023-10-12T06:38:49.314502Z",
75+
"path": "test_dir/test2.txt",
76+
"size": 14
77+
}
78+
]
79+
}

0 commit comments

Comments
 (0)