| 1 |
"""Test notifications namespace.""" |
| 2 |
# pylint: disable=missing-docstring |
| 3 |
import pytest |
| 4 |
|
| 5 |
from aiogithubapi import GitHubAPI |
| 6 |
from aiogithubapi.models.notification import GitHubNotificationModel |
| 7 |
|
| 8 |
from tests.common import ( |
| 9 |
MockedRequests, |
| 10 |
) |
| 11 |
|
| 12 |
|
| 13 |
@pytest.mark.asyncio |
| 14 |
async def test_list_notifications(github_api: GitHubAPI, mock_requests: MockedRequests): |
| 15 |
response = await github_api.notifications.list() |
| 16 |
assert response.status == 200 |
| 17 |
assert isinstance(response.data, list) |
| 18 |
assert len(response.data) == 1 |
| 19 |
assert isinstance(response.data[0], GitHubNotificationModel) |
| 20 |
assert response.data[0].id == "1" |
| 21 |
assert response.data[0].subject.title == "Greetings" |
| 22 |
assert response.data[0].reason == "subscribed" |
| 23 |
assert response.data[0].unread is True |
| 24 |
assert mock_requests.called == 1 |
| 25 |
assert mock_requests.last_request["url"] == "https://api.github.com/notifications" |