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

Handle None gracefully in repository topics #4738

Merged
merged 2 commits into from
Nov 12, 2024

Conversation

StevenMaude
Copy link
Contributor

This fixes a failing verification test.

Usually `repositoryTopics` is either like:

* `'repositoryTopics': {'nodes': []}`
* `'repositoryTopics': {'nodes': [{'topic': {'name': 'non-research'}}]}`

But it can be:

* `'repositoryTopics': {'nodes': [None]}`

This is as found from:

https://github.com/opensafely-testing/github-api-testing-topics

when running `TestGithubAPINonPrivate::test_get_repos_with_branches()`

That repository has no topics set.

Note that:

https://github.com/opensafely-testing/github-api-testing-private

which I don't have access to, has an empty list, and presumably no
topics set.

Maybe there's a distinction between "no topics because this repository
never had any topics set" and "no topics because this repository has had
topics deleted"?
We currently don't have any methods with underscores in
`FakeGitHubAPIWithErrors`, so the branch of "name starts with an
underscore" is never exercised.

It's still useful to have a check for this, in case such methods are
added in future.
@StevenMaude
Copy link
Contributor Author

This run with similar changes passed the tests.

@StevenMaude StevenMaude merged commit 4e417f8 into main Nov 12, 2024
7 checks passed
@StevenMaude StevenMaude deleted the steve/fix-get-repos-with-branches-verification-test branch November 12, 2024 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants