Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/svn/tests/test_loader.py
Show First 20 Lines • Show All 548 Lines • ▼ Show 20 Lines | def test_loader_svn_visit_with_eol_style(swh_config, datadir, tmp_path): | ||||
) | ) | ||||
stats = get_stats(loader.storage) | stats = get_stats(loader.storage) | ||||
assert stats["origin"] == 1 | assert stats["origin"] == 1 | ||||
assert stats["origin_visit"] == 1 | assert stats["origin_visit"] == 1 | ||||
assert stats["snapshot"] == 1 | assert stats["snapshot"] == 1 | ||||
class SvnLoaderTest10(BaseSvnLoaderTest): # noqa | def test_loader_svn_visit_with_mixed_crlf_lf(swh_config, datadir, tmp_path): | ||||
"""Check that a svn repo containing a versioned file with mixed | """Check that a svn repo containing a versioned file with mixed | ||||
CRLF/LF line endings with svn:eol-style property set to 'native' | CRLF/LF line endings with svn:eol-style property set to 'native' | ||||
(this is a violation of svn specification as mixed line endings | (this is a violation of svn specification as mixed line endings | ||||
for textual content should not be stored when the svn:eol-style | for textual content should not be stored when the svn:eol-style | ||||
property is set) can be loaded anyway. | property is set) can be loaded anyway. | ||||
""" | """ | ||||
archive_name = "pyang-repo-r343-eol-native-mixed-lf-crlf" | |||||
archive_path = os.path.join(datadir, f"{archive_name}.tgz") | |||||
repo_url = prepare_repository_from_archive(archive_path, archive_name, tmp_path) | |||||
def setUp(self): | loader = SvnLoader(repo_url) | ||||
super().setUp( | |||||
archive_name="pyang-repo-r343-eol-native-mixed-lf-crlf.tgz", | |||||
filename="pyang-repo-r343-eol-native-mixed-lf-crlf", | |||||
) | |||||
def test_load(self): | |||||
"""Load repo with mixed CRLF/LF endings (svn:eol-style:native) is ok | |||||
""" | |||||
assert self.loader.load() == {"status": "eventful"} | |||||
expected_revisions = { | assert loader.load() == {"status": "eventful"} | ||||
"9c6962eeb9164a636c374be700672355e34a98a7": "16aa6b6271f3456d4643999d234cf39fe3d0cc5a" # noqa | expected_snapshot = { | ||||
"id": PYANG_SNAPSHOT, | |||||
"branches": { | |||||
"HEAD": { | |||||
"target": "9c6962eeb9164a636c374be700672355e34a98a7", | |||||
"target_type": "revision", | |||||
} | } | ||||
}, | |||||
self.assertRevisionsContain(expected_revisions) | } | ||||
self.assertCountSnapshots(1) | check_snapshot(expected_snapshot, loader.storage) | ||||
self.assertEqual(self.loader.visit_status(), "full") | |||||
assert_last_visit_matches( | assert_last_visit_matches( | ||||
self.storage, | loader.storage, repo_url, status="full", type="svn", snapshot=PYANG_SNAPSHOT, | ||||
self.repo_url, | |||||
status="full", | |||||
type="svn", | |||||
snapshot=PYANG_SNAPSHOT, | |||||
) | ) | ||||
stats = get_stats(loader.storage) | |||||
assert stats["origin"] == 1 | |||||
assert stats["origin_visit"] == 1 | |||||
assert stats["snapshot"] == 1 | |||||
class SvnLoaderTest11(BaseSvnLoaderTest): | class SvnLoaderTest11(BaseSvnLoaderTest): | ||||
"""Context: | """Context: | ||||
- Repository with svn:external (which is not deal with for now) | - Repository with svn:external (which is not deal with for now) | ||||
- Visit is partial with as much data loaded as possible | - Visit is partial with as much data loaded as possible | ||||
""" | """ | ||||
▲ Show 20 Lines • Show All 286 Lines • Show Last 20 Lines |