swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7f966fdc5128>
requests_mock = <requests_mock.mocker.Mocker object at 0x7f966fdc55f8>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f966fdc5358>
maven_index = 'doc 0\n field 0\n name u\n type string\n value al.aldi|sprova4j|0.1.0|sources|jar\n field 1\n name m\n ...e rootGroups\n field 19\n name rootGroupsList\n type string\n value al\nEND\nchecksum 00000000003321211082\n'
maven_pom_1 = '<?xml version="1.0" encoding="UTF-8"?>\n<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.a...actId>\n <version>3.10.0</version>\n <scope>test</scope>\n </dependency>\n </dependencies>\n</project>\n'
maven_pom_2 = '<?xml version="1.0" encoding="UTF-8"?>\n<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.a...actId>\n <version>3.10.0</version>\n <scope>test</scope>\n </dependency>\n </dependencies>\n</project>\n'
def test_maven_full_listing(
swh_scheduler, requests_mock, mocker, maven_index, maven_pom_1, maven_pom_2,
):
"""Covers full listing of multiple pages, checking page results and listed
origins, statelessness."""
lister = MavenLister(
scheduler=swh_scheduler,
url=MVN_URL,
instance="maven.org",
index_url=INDEX_URL,
incremental=False,
)
# Set up test.
index_text = maven_index
requests_mock.get(INDEX_URL, text=index_text)
requests_mock.get(URL_POM_1, text=maven_pom_1)
requests_mock.get(URL_POM_2, text=maven_pom_2)
# Then run the lister.
stats = lister.run()
# Start test checks.
assert stats.pages == 4
assert stats.origins == 4
scheduler_origins = swh_scheduler.get_listed_origins(lister.lister_obj.id).results
origin_urls = [origin.url for origin in scheduler_origins]
assert sorted(origin_urls) == sorted(LIST_GIT + LIST_SRC)
for origin in scheduler_origins:
if origin.visit_type == "maven":
for src in LIST_SRC_DATA:
if src.get("url") == origin.url:
artifact = origin.extra_loader_arguments["artifacts"][0]
> assert src.get("time") == artifact["time"]
E AssertionError: assert '2021-07-12 1....335000+00:00' == '2021-07-12 1....335000+00:00'
E - 2021-07-12 17:06:59.335000+00:00
E ? ^
E + 2021-07-12 19:06:59.335000+00:00
E ? ^
.tox/py3/lib/python3.7/site-packages/swh/lister/maven/tests/test_lister.py:140: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Nov 26 2021, 5:41 PM