Skip to content
Snippets Groups Projects
Verified Commit f2c319c6 authored by Georg Krause's avatar Georg Krause
Browse files

Fix formatting of test files

parent 83cabe6f
No related branches found
No related tags found
1 merge request!1Add basic model tests
Pipeline #23708 failed
Showing
with 56 additions and 55 deletions
import pytest
...@@ -2,7 +2,7 @@ import pytest ...@@ -2,7 +2,7 @@ import pytest
from funkwhale_api_client import Client from funkwhale_api_client import Client
@pytest.fixture @pytest.fixture
def client() -> Client: def client() -> Client:
return Client(base_url="https://soundship.de") return Client(base_url="https://soundship.de")
from funkwhale_api_client.models import PaginatedAlbumList
from funkwhale_api_client.api.activity import activity_list from funkwhale_api_client.api.activity import activity_list
def test_activity_list(client): def test_activity_list(client):
response = activity_list.sync_detailed(client=client) response = activity_list.sync_detailed(client=client)
print(response) print(response)
......
from funkwhale_api_client.api.albums import albums_list, albums_retrieve
from funkwhale_api_client.models import PaginatedAlbumList from funkwhale_api_client.models import PaginatedAlbumList
from funkwhale_api_client.api.albums import albums_list, albums_retrieve
def test_album_list(client): def test_album_list(client):
albums: PaginatedAlbumList = albums_list.sync(client=client) albums: PaginatedAlbumList = albums_list.sync(client=client)
...@@ -8,6 +8,7 @@ def test_album_list(client): ...@@ -8,6 +8,7 @@ def test_album_list(client):
for album in albums.results: for album in albums.results:
print(album.title) print(album.title)
def test_album_retrieve(client): def test_album_retrieve(client):
album = albums_retrieve.sync(client=client, id=12) album = albums_retrieve.sync(client=client, id=12)
print(album) print(album)
from funkwhale_api_client.models import PaginatedArtistWithAlbumsList
from funkwhale_api_client.api.artists import artists_list from funkwhale_api_client.api.artists import artists_list
from funkwhale_api_client.models import PaginatedArtistWithAlbumsList
def test_artist_list(client): def test_artist_list(client):
artists: PaginatedArtistWithAlbumsList | None = artists_list.sync(client=client) artists: PaginatedArtistWithAlbumsList | None = artists_list.sync(client=client)
......
import pytest
import json import json
import pytest
@pytest.fixture @pytest.fixture
def load_data(): def load_data():
def _load_data(requested_file: str): def _load_data(requested_file: str):
with open(f'tests/data/{requested_file}.json') as data: with open(f"tests/data/{requested_file}.json") as data:
return json.load(data) return json.load(data)
return _load_data return _load_data
import json
from funkwhale_api_client.models.activity_object import ActivityObject from funkwhale_api_client.models.activity_object import ActivityObject
def test_ActivityObject(load_data): def test_ActivityObject(load_data):
response = load_data("activity") response = load_data("activity")
activity: ActivityObject = ActivityObject.from_dict(response) activity: ActivityObject = ActivityObject.from_dict(response)
......
import json
from funkwhale_api_client.models.activity_related_object import ActivityRelatedObject from funkwhale_api_client.models.activity_related_object import ActivityRelatedObject
def test_ActivityRelatedObject(load_data): def test_ActivityRelatedObject(load_data):
response = load_data("activity") response = load_data("activity")
activity_related_object: ActivityRelatedObject = ActivityRelatedObject.from_dict(response) activity_related_object: ActivityRelatedObject = ActivityRelatedObject.from_dict(response)
......
import json
from funkwhale_api_client.models.album import Album from funkwhale_api_client.models.album import Album
def test_Album(load_data): def test_Album(load_data):
response = load_data("album") response = load_data("album")
album: Album = Album.from_dict(response) album: Album = Album.from_dict(response)
......
import json
from funkwhale_api_client.models.api_mutation import APIMutation from funkwhale_api_client.models.api_mutation import APIMutation
def test_APIMutation(load_data): def test_APIMutation(load_data):
response = load_data("api_mutation") response = load_data("api_mutation")
mutation: APIMutation = APIMutation.from_dict(response) mutation: APIMutation = APIMutation.from_dict(response)
......
import json
from funkwhale_api_client.models.artist_with_albums import ArtistWithAlbums from funkwhale_api_client.models.artist_with_albums import ArtistWithAlbums
def test_ArtistWithAlbums(load_data): def test_ArtistWithAlbums(load_data):
response = load_data("artist") response = load_data("artist")
artist: ArtistWithAlbums = ArtistWithAlbums.from_dict(response) artist: ArtistWithAlbums = ArtistWithAlbums.from_dict(response)
......
import json
from funkwhale_api_client.models.attachment import Attachment from funkwhale_api_client.models.attachment import Attachment
def test_Attachment(load_data): def test_Attachment(load_data):
response = load_data("attachment") response = load_data("attachment")
attachment: Attachment = Attachment.from_dict(response) attachment: Attachment = Attachment.from_dict(response)
......
import json
from funkwhale_api_client.models.channel import Channel from funkwhale_api_client.models.channel import Channel
def test_Channel(load_data): def test_Channel(load_data):
response = load_data("channel") response = load_data("channel")
channel: Channel = Channel.from_dict(response) channel: Channel = Channel.from_dict(response)
......
import json
from funkwhale_api_client.models.global_preference import GlobalPreference from funkwhale_api_client.models.global_preference import GlobalPreference
def test_GlobalPreference(load_data): def test_GlobalPreference(load_data):
response = load_data("settings") response = load_data("settings")
settings: GlobalPreference = GlobalPreference.from_dict(response) settings: GlobalPreference = GlobalPreference.from_dict(response)
......
import json
from funkwhale_api_client.models.global_preference_request import GlobalPreferenceRequest from funkwhale_api_client.models.global_preference_request import GlobalPreferenceRequest
def test_GlobalPreferenceRequest(load_data): def test_GlobalPreferenceRequest(load_data):
response = load_data("global_preference_request") response = load_data("global_preference_request")
preference_request: GlobalPreferenceRequest = GlobalPreferenceRequest.from_dict(response) preference_request: GlobalPreferenceRequest = GlobalPreferenceRequest.from_dict(response)
......
import json
from funkwhale_api_client.models.inbox_item import InboxItem from funkwhale_api_client.models.inbox_item import InboxItem
def test_InboxItem(load_data): def test_InboxItem(load_data):
response = load_data("federation_inbox_item") response = load_data("federation_inbox_item")
inbox_item: InboxItem = InboxItem.from_dict(response) inbox_item: InboxItem = InboxItem.from_dict(response)
......
import json
from funkwhale_api_client.models.library import Library from funkwhale_api_client.models.library import Library
def test_Library(load_data): def test_Library(load_data):
response = load_data("library") response = load_data("library")
library: Library = Library.from_dict(response) library: Library = Library.from_dict(response)
......
import json
from funkwhale_api_client.models.library_follow import LibraryFollow from funkwhale_api_client.models.library_follow import LibraryFollow
def test_LibraryFollow(load_data): def test_LibraryFollow(load_data):
response = load_data("library_follow") response = load_data("library_follow")
library_follow: LibraryFollow = LibraryFollow.from_dict(response) library_follow: LibraryFollow = LibraryFollow.from_dict(response)
......
import json
from funkwhale_api_client.models.library_follow import LibraryFollow from funkwhale_api_client.models.library_follow import LibraryFollow
def test_LibraryFollowAll(load_data): def test_LibraryFollowAll(load_data):
response = load_data("library_follow") response = load_data("library_follow")
library_follow_all: LibraryFollow = LibraryFollow.from_dict(response) library_follow_all: LibraryFollow = LibraryFollow.from_dict(response)
......
import json
from funkwhale_api_client.models.library_follow_request import LibraryFollowRequest from funkwhale_api_client.models.library_follow_request import LibraryFollowRequest
def test_LibraryFollowRequest(load_data): def test_LibraryFollowRequest(load_data):
response = load_data("library_follow_request") response = load_data("library_follow_request")
follow_request: LibraryFollowRequest = LibraryFollowRequest.from_dict(response) follow_request: LibraryFollowRequest = LibraryFollowRequest.from_dict(response)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment