Skip to content

Commit

Permalink
Increase tests coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mvalik committed Nov 6, 2023
1 parent a956076 commit 1d063bc
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion tests/test_api_v10.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .utils import create_waiver
from waiverdb import __version__
from waiverdb.models import Waiver
from waiverdb.api_v1 import get_resultsdb_result


@pytest.fixture
Expand All @@ -37,6 +38,28 @@ def mocked_resultsdb():
yield mocked_resultsdb


def test_get_resultsdb_result():
test_id = 10
with patch('requests.Session.request') as req:
resp = Mock()
resp.json.return_value = {
'data': {
'type': ['koji_build'],
'item': ['somebuild'],
'scenario': ['somescenario'],
},
'testcase': {'name': 'sometest'}
}
req.return_value = resp
assert get_resultsdb_result(test_id) == resp.json.return_value
req.assert_called_with(
'GET',
f'https://taskotron.fedoraproject.org/resultsdb_api/api/v2.0/results/{test_id}',
headers={'Content-Type': 'application/json'},
timeout=60
)


def test_create_waiver(mocked_user, client, session):
data = {
'subject_type': 'koji_build',
Expand Down Expand Up @@ -87,7 +110,7 @@ def test_create_waiver_with_subject(mocked_user, client, session):
def test_create_waiver_with_result_id(mocked_user, mocked_resultsdb, client, session):
mocked_resultsdb.return_value = {
'data': {
'type': ['koji_build'],
'type': ['brew-build'], # will be replaced by koji_build
'item': ['somebuild'],
'scenario': ['somescenario'],
},
Expand Down

0 comments on commit 1d063bc

Please sign in to comment.