|
4 | 4 | import tempfile |
5 | 5 | import subprocess |
6 | 6 | import shutil |
7 | | -from datetime import datetime, timedelta |
| 7 | +from datetime import datetime, timedelta, date |
8 | 8 | import pytest |
9 | 9 | import pytz |
10 | 10 | import sqlite3 |
@@ -1860,3 +1860,33 @@ def test_changesets_download(mc): |
1860 | 1860 | assert os.path.exists(diff_file) |
1861 | 1861 | assert mp.geodiff.has_changes(diff_file) |
1862 | 1862 | assert mp.geodiff.changes_count(diff_file) == 3 |
| 1863 | + |
| 1864 | + |
| 1865 | +def test_version_info(mc): |
| 1866 | + """Check retrieving detailed information about single project version.""" |
| 1867 | + test_project = "test_version_info" |
| 1868 | + project = API_USER + "/" + test_project |
| 1869 | + project_dir = os.path.join(TMP_DIR, test_project) # primary project dir |
| 1870 | + test_gpkg = "test.gpkg" |
| 1871 | + file_path = os.path.join(project_dir, "test.gpkg") |
| 1872 | + |
| 1873 | + cleanup(mc, project, [project_dir]) |
| 1874 | + |
| 1875 | + os.makedirs(project_dir, exist_ok=True) |
| 1876 | + shutil.copy(os.path.join(TEST_DATA_DIR, "base.gpkg"), file_path) |
| 1877 | + mc.create_project_and_push(test_project, project_dir) |
| 1878 | + |
| 1879 | + shutil.copy(os.path.join(TEST_DATA_DIR, "inserted_1_A.gpkg"), file_path) |
| 1880 | + mc.push_project(project_dir) |
| 1881 | + |
| 1882 | + shutil.copy(os.path.join(TEST_DATA_DIR, "inserted_1_A_mod.gpkg"), file_path) |
| 1883 | + mc.push_project(project_dir) |
| 1884 | + |
| 1885 | + info = mc.project_version_info(project, 2)[0] |
| 1886 | + assert info["namespace"] == API_USER |
| 1887 | + assert info["project_name"] == test_project |
| 1888 | + assert info["name"] == "v2" |
| 1889 | + assert info["author"] == API_USER |
| 1890 | + created = datetime.strptime(info["created"], "%Y-%m-%dT%H:%M:%SZ") |
| 1891 | + assert created.date() == date.today() |
| 1892 | + assert info["changes"]["updated"][0]["size"] == 98304 |
0 commit comments