Skip to content

Commit

Permalink
Merge pull request #10856 from bodintsov/feature/sitemap_generator_un…
Browse files Browse the repository at this point in the history
…it_tests

[ENG-6648] Updated tests for sitemap generator
  • Loading branch information
cslzchen authored Dec 17, 2024
2 parents 1bee842 + 90e6ce7 commit cc435b0
Showing 1 changed file with 12 additions and 1 deletion.
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

0 comments on commit cc435b0

Please sign in to comment.