tests.test_forge moduleΒΆ
Tests for the multi-forge metrics reader.
- tests.test_forge.GITLAB_PROJECT = 'https://gitlab.example.org/api/v4/projects/fruits%2Fpapaya'ΒΆ
The GitLab endpoint of
fruits/papaya, its path encoded as one segment.
- tests.test_forge.FORGEJO_REPO = 'https://codeberg.example.org/api/v1/repos/fruits/papaya'ΒΆ
The Forgejo endpoint of
fruits/papaya, its path left as is.
- tests.test_forge.REST_ANSWERS = {Forge.FORGEJO: {'https://codeberg.example.org/api/v1/repos/fruits/papaya': {'created_at': '2020-05-01T10:00:00Z', 'stars_count': 7}, 'https://codeberg.example.org/api/v1/repos/fruits/papaya/commits?limit=1': [{'commit': {'committer': {'date': '2026-09-02T09:00:00Z'}}}], 'https://codeberg.example.org/api/v1/repos/fruits/papaya/releases?limit=1': [{'published_at': '2026-08-01T09:00:00Z'}], 'https://codeberg.example.org/api/v1/repos/fruits/papaya/tags?limit=1': [{'commit': {'created': '2026-09-01T09:00:00Z'}}]}, Forge.GITLAB: {'https://gitlab.example.org/api/v4/projects/fruits%2Fpapaya': {'created_at': '2020-05-01T10:00:00Z', 'star_count': 7}, 'https://gitlab.example.org/api/v4/projects/fruits%2Fpapaya/releases?per_page=1': [{'released_at': '2026-08-01T09:00:00Z'}], 'https://gitlab.example.org/api/v4/projects/fruits%2Fpapaya/repository/commits?per_page=1': [{'committed_date': '2026-09-02T09:00:00Z'}], 'https://gitlab.example.org/api/v4/projects/fruits%2Fpapaya/repository/tags?per_page=1&order_by=updated&sort=desc': [{'commit': {'created_at': '2026-09-01T09:00:00Z'}}]}}ΒΆ
What each REST forge answers about one repository, keyed by endpoint.
- tests.test_forge.HOSTS = {Forge.FORGEJO: 'codeberg.example.org', Forge.GITLAB: 'gitlab.example.org'}ΒΆ
The instance each REST forge is read on.
- tests.test_forge.test_split_repo_url(url, expected)[source]ΒΆ
Check a repository URL splits into its host and its namespace path.
- tests.test_forge.test_split_repo_url_rejects_incomplete(url)[source]ΒΆ
Check a URL without an owner and a name is refused rather than guessed.
- tests.test_forge.test_canonical_url(subject, expected)[source]ΒΆ
Check every way of naming a subject lands on one spelling.
The store keys on this, so two configurations naming the same repository differently must not accrue two disjoint histories.
- tests.test_forge.test_canonical_url_rejects_what_it_cannot_resolve(subject)[source]ΒΆ
Check a half-written subject raises rather than becoming a wrong URL.
- tests.test_forge.test_forge_of_never_guesses_an_unknown_host()[source]ΒΆ
Check an undeclared host raises instead of sampling nothing.
A silently unsampled subject is worse than a loud one: it renders as a project nobody follows rather than as a project nobody could read.
- tests.test_forge.test_forge_of_rejects_an_unimplemented_forge()[source]ΒΆ
Check a declared host naming software nothing reads is refused.
- tests.test_forge.test_known_forges_are_implemented()[source]ΒΆ
Check every bundled host names a forge the reader actually speaks.
- tests.test_forge.test_newest_dated(release, tag, expected)[source]ΒΆ
Check the more recent of a release and a tag wins, and says which it is.
- tests.test_forge.test_readings_yield_only_registered_metrics()[source]ΒΆ
Check the reader and the metric registry cannot drift apart.
A reading yielded under an ID the registry does not know raises inside
upsert, mid-collection, on the one code path nobody watches.
- tests.test_forge.test_readings_omit_what_a_forge_did_not_answer()[source]ΒΆ
Check a project with no release yields no row rather than a blank one.
- tests.test_forge.test_readings_leave_the_creation_date_to_the_sampler()[source]ΒΆ
Check
createdis not yielded as a metric of its own.It is not a reading but the origin of one, recorded by the sampler as a zero-star reading on that date.
- tests.test_forge.test_readings_default_a_missing_release_source()[source]ΒΆ
Check a release with no stated kind still records one.
The storeβs consumers gate release-only rendering on this value, so an empty cell beside a real date would read as a project that never released.
- tests.test_forge.test_every_forge_but_github_has_rest_endpoints()[source]ΒΆ
Check the dispatch finds a table for every forge it does not query by GraphQL.
- tests.test_forge.test_rest_metrics_read_each_forge_through_its_table(monkeypatch, forge)[source]ΒΆ
Check one reader serves both REST forges, each through its own endpoints.
- tests.test_forge.test_rest_metrics_leave_out_what_a_listing_lacks(monkeypatch, forge)[source]ΒΆ
Check an empty release, tag or commit listing is a missing reading.
- tests.test_forge.test_rest_metrics_answer_none_for_an_unreadable_repository(monkeypatch)[source]ΒΆ
Check a repository the forge does not serve is unreadable, not empty.
- tests.test_forge.RELEASED = {'publishedAt': '2026-08-01T09:00:00Z'}ΒΆ
The
latestReleaseobject of a repository that cut a release.
- tests.test_forge.BRANCH = {'target': {'committedDate': '2026-09-02T09:00:00Z'}}ΒΆ
The
defaultBranchRefobject, its head commit dated.