Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENG-6648] Updated tests for sitemap generator #10856

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion osf_tests/test_generate_sitemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ def preprint_osf(self, project_preprint_osf, user_admin_project_public, provider
return PreprintFactory(project=project_preprint_osf,
creator=user_admin_project_public,
provider=provider_osf)
@pytest.fixture(autouse=True)
def preprint_osf_blank(self, project_preprint_osf, user_admin_project_public, provider_osf):
return PreprintFactory(project=project_preprint_osf,
creator=user_admin_project_public,
provider=provider_osf)

@pytest.fixture(autouse=True)
def preprint_osf_version(self, preprint_osf_blank):
return PreprintFactory.create_version(create_from=preprint_osf_blank, creator=preprint_osf_blank.creator)

@pytest.fixture(autouse=True)
def preprint_withdrawn(self, project_preprint_osf, user_admin_project_public, provider_osf):
Expand All @@ -118,7 +127,7 @@ def preprint_other(self, project_preprint_other, user_admin_project_public, prov
def all_included_links(self, user_admin_project_public, user_admin_project_private, project_registration_public,
project_preprint_osf, project_preprint_other,
registration_active, provider_other, provider_osf,
preprint_osf, preprint_other, preprint_withdrawn):
preprint_osf, preprint_osf_version, preprint_other, preprint_withdrawn):
# Return urls of all fixtures
urls_to_include = [item['loc'] for item in settings.SITEMAP_STATIC_URLS]
urls_to_include.extend([
Expand All @@ -129,9 +138,11 @@ def all_included_links(self, user_admin_project_public, user_admin_project_priva
project_preprint_other.url,
registration_active.url,
f'/preprints/{provider_osf._id}/{preprint_osf._id}',
f'/preprints/{provider_osf._id}/{preprint_osf_version._id}',
f'/preprints/{provider_other._id}/{preprint_other._id}',
f'/preprints/{provider_osf._id}/{preprint_withdrawn._id}',
f'/{preprint_osf._id}/download/?format=pdf',
f'/{preprint_osf_version._id}/download/?format=pdf',
f'/{preprint_other._id}/download/?format=pdf'
])
urls_to_include = [urljoin(settings.DOMAIN, item) for item in urls_to_include]
Expand Down
Loading