Skip to content

Add Unit tests for Jira API#279

Merged
isabelrios merged 5 commits intomasterfrom
unit-test-jira-api
Feb 4, 2026
Merged

Add Unit tests for Jira API#279
isabelrios merged 5 commits intomasterfrom
unit-test-jira-api

Conversation

@isabelrios
Copy link
Collaborator

@isabelrios isabelrios commented Jan 22, 2026

We would like to add unit tests to our APIs so that we know when something may be broken by changes in PRs.
We may need to also run this periodically to check possible breakages in APIs upgrades.

@isabelrios
Copy link
Collaborator Author

As part of PRs checks, Unit Tests will run first and if they succeed, then the rest of workflows will start.
imagen

@isabelrios isabelrios marked this pull request as ready for review January 23, 2026 14:41
@rpappalax
Copy link
Collaborator

Without understanding all the minutia of the unit tests, think I get the gist and they look good to me. Essentially, asserts of various kinds to ensure the API still behaves as we expect it should.

How frequently would you run these?

No nits. LGTM on my end.

@isabelrios
Copy link
Collaborator Author

Without understanding all the minutia of the unit tests, think I get the gist and they look good to me. Essentially, asserts of various kinds to ensure the API still behaves as we expect it should.

How frequently would you run these?

No nits. LGTM on my end.

Tests will run as a check for each commit in PRs, I added them in the preflight-push.yaml but we can also have them running daily in a cron, do you want me to add that?

@rpappalax
Copy link
Collaborator

Right now we're not being rate limited for our usage on GitHub enterprise but we could be. I guess the question would be what it makes sense to have them run on a CRON and then if a job ever breaks, we could always run the unit tests to see if that indeed is the problem. That way we're not running them every time??

@isabelrios
Copy link
Collaborator Author

Right now we're not being rate limited for our usage on GitHub enterprise but we could be. I guess the question would be what it makes sense to have them run on a CRON and then if a job ever breaks, we could always run the unit tests to see if that indeed is the problem. That way we're not running them every time??

Well, the idea of the unit tests is to make sure a PR does not break the queries.. that is why I think they should run as a pre check

query = "search/jql?jql=project=MTE"
self.client.get_search(query, "issues")
params_used = mock_get.call_args.kwargs["params"]
self.assertEqual(params_used["fields"], "key,summary")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also check the full URL as we're checking params but not verifying the full URL passed to requests.get.

called_url = mock_get.call_args.args[0]
self.assertEqual(called_url, f"{JIRA_HOST}search/jql")

@isabelrios isabelrios merged commit 014b1d4 into master Feb 4, 2026
17 checks passed
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