"""Test for revenue_analysis schema.""" from datetime import datetime from moneyhub.constants.constants import PAGINATION_TYPE_STANDARD from moneyhub.constants.constants import StatementPeriodStatus from moneyhub.schemas.pagination import PaginationSchema from moneyhub.schemas.revenue_analysis import AccountRevenueSchema from moneyhub.schemas.revenue_analysis import AccountStatementPeriodRevenueSchema from moneyhub.schemas.revenue_analysis import PaginatedRevenueByActivityMonthSchema from moneyhub.schemas.revenue_analysis import PaginatedRevenueByArtistSchema from moneyhub.schemas.revenue_analysis import PaginatedRevenueByImprintSchema from moneyhub.schemas.revenue_analysis import PaginatedRevenueByProductSchema from moneyhub.schemas.revenue_analysis import PaginatedRevenueByProjectSchema from moneyhub.schemas.revenue_analysis import PaginatedRevenueByRecordingSchema from moneyhub.schemas.revenue_analysis import PaginatedRevenueByStoreSchema from moneyhub.schemas.revenue_analysis import PaginatedRevenueBySubaccountSchema from moneyhub.schemas.revenue_analysis import PaginatedRevenueByTrackSchema from moneyhub.schemas.revenue_analysis import RevenueByActivityMonthSchema from moneyhub.schemas.revenue_analysis import RevenueByArtistSchema from moneyhub.schemas.revenue_analysis import RevenueByCountrySchema from moneyhub.schemas.revenue_analysis import RevenueByImprintSchema from moneyhub.schemas.revenue_analysis import RevenueByProductSchema from moneyhub.schemas.revenue_analysis import RevenueByProjectSchema from moneyhub.schemas.revenue_analysis import RevenueByRecordingSchema from moneyhub.schemas.revenue_analysis import RevenueByStatementPeriodSchema from moneyhub.schemas.revenue_analysis import RevenueByStoreSchema from moneyhub.schemas.revenue_analysis import RevenueBySubaccountSchema from moneyhub.schemas.revenue_analysis import RevenueByTrackSchema from moneyhub.schemas.revenue_analysis import RevenueByTransactionTypeSchema from moneyhub.schemas.revenue_analysis import RevenuePayeeCurrencyTotalsSchema from moneyhub.schemas.revenue_analysis import StoreSchema from moneyhub.schemas.revenue_analysis import TransactionTypeSchema def test_revenue_by_product_schema(): """Test getting revenue by product schema.""" expected = RevenueByProductSchema( product_id=3842056, mechanical_deduction_amount_payee_currency=100, publisher_admin_fee_payee_currency=-1, account_payee_currency='GBP', project_name='Project Alpha', net_share_payee_currency=3.248464003404, gross_revenue_payee_currency=3.248464003404, subaccount_revenue=2.7483748374837 ) payload = { 'product_id': 3842056, 'mechanical_deduction_amount_payee_currency': 100, 'publisher_admin_fee_payee_currency': -1, 'account_payee_currency': 'GBP', 'project_name': 'Project Alpha', 'net_share_payee_currency': 3.248464003404, 'gross_revenue_payee_currency': 3.248464003404, 'subaccount_revenue': 2.7483748374837 } actual = RevenueByProductSchema(**payload) assert actual == expected def test_revenue_by_recording_schema(): """Test getting revenue by recording schema.""" expected = RevenueByRecordingSchema( recording_id='1234', recording_title='Title', artist='Artist', version='Acoustic', isrc='JPYE70900611', account_id=57608, contract_id=None, account_payee_currency='JPY', net_share_payee_currency=8.00, gross_revenue_payee_currency=10.00, ) payload = { 'recording_id': '1234', 'recording_title': 'Title', 'artist': 'Artist', 'version': 'Acoustic', 'isrc': 'JPYE70900611', 'account_id': 57608, 'contract_id': None, 'account_payee_currency': 'JPY', 'net_share_payee_currency': 8.00, 'gross_revenue_payee_currency': 10.00, } actual = RevenueByRecordingSchema(**payload) assert actual == expected def test_revenue_by_recording_schema_int_id(): """Test getting revenue by recording schema with an in recording ID.""" expected = RevenueByRecordingSchema( recording_id=1234, recording_title='Title', artist='Artist', version='Acoustic', isrc='JPYE70900611', account_id=57608, contract_id=None, account_payee_currency='JPY', net_share_payee_currency=8.00, gross_revenue_payee_currency=10.00, ) payload = { 'recording_id': '1234', 'recording_title': 'Title', 'artist': 'Artist', 'version': 'Acoustic', 'isrc': 'JPYE70900611', 'account_id': 57608, 'contract_id': None, 'account_payee_currency': 'JPY', 'net_share_payee_currency': 8.00, 'gross_revenue_payee_currency': 10.00, } actual = RevenueByRecordingSchema(**payload) assert actual == expected def test_revenue_by_statement_period_schema(): """Test getting revenue by statement period schema.""" expected = RevenueByStatementPeriodSchema( statement_period_id=123, account_payee_currency='JPY', net_revenue_payee_currency=100.0, gross_revenue_payee_currency=200.0, net_publishing_revenue_payee_currency=50.0, gross_publishing_revenue_payee_currency=75.0, ) payload = { 'statement_period_id': 123, 'account_payee_currency': 'JPY', 'net_revenue_payee_currency': 100.0, 'gross_revenue_payee_currency': 200.0, 'net_publishing_revenue_payee_currency': 50.0, 'gross_publishing_revenue_payee_currency': 75.0, } actual = RevenueByStatementPeriodSchema(**payload) assert actual == expected def test_revenue_by_store_schema(): """Test getting revenue by recording schema.""" expected = RevenueByStoreSchema( store_id=124, store_name='iTunes/Apple', account_payee_currency='USD', net_revenue_payee_currency=-8008.00, gross_revenue_payee_currency=-1120.00, subaccount_revenue=None ) payload = { 'store_id': 124, 'store_name': 'iTunes/Apple', 'account_payee_currency': 'USD', 'net_revenue_payee_currency': -8008.00, 'gross_revenue_payee_currency': -1120.00, } actual = RevenueByStoreSchema(**payload) assert actual == expected def test_revenue_by_project_schema(): """Test getting revenue by project schema.""" expected = RevenueByProjectSchema( project_id=124, project_name='Project Atlas', project_code='PA-124', project_artist='Atlas Artist', product_count=3, account_payee_currency='USD', net_share_payee_currency=-8008.00, gross_revenue_payee_currency=-1120.00, subaccount_revenue=None ) payload = { 'project_id': 124, 'project_name': 'Project Atlas', 'project_code': 'PA-124', 'project_artist': 'Atlas Artist', 'product_count': 3, 'account_payee_currency': 'USD', 'net_share_payee_currency': -8008.00, 'gross_revenue_payee_currency': -1120.00, } actual = RevenueByProjectSchema(**payload) assert actual == expected def test_store_schema(): """Test getting store schema.""" expected = StoreSchema( store_id=124, store_name='iTunes/Apple' ) payload = { 'store_id': 124, 'store_name': 'iTunes/Apple' } actual = StoreSchema(**payload) assert actual == expected def test_revenue_by_store_schema_with_zero_totals(): """Test getting revenue by recording schema.""" expected = RevenueByStoreSchema( store_id=124, store_name='iTunes/Apple', account_payee_currency='USD', net_revenue_payee_currency=None, gross_revenue_payee_currency=None, ) payload = { 'store_id': 124, 'store_name': 'iTunes/Apple', 'account_payee_currency': 'USD', 'net_revenue_payee_currency': None, 'gross_revenue_payee_currency': None, } actual = RevenueByStoreSchema(**payload) assert expected == actual def test_revenue_payee_currency_totals_schema(): """Test getting revenue by recording schema.""" expected = RevenuePayeeCurrencyTotalsSchema( net_revenue_payee_currency=-8008.00, gross_revenue_payee_currency=-1120.00, ) data = { 'net_revenue_payee_currency': -8008.00, 'gross_revenue_payee_currency': -1120.00, } actual = RevenuePayeeCurrencyTotalsSchema(**data) assert actual == expected def test_paginated_revenue_by_recording_schema(): """Test getting paginated revenue by recording schema.""" expected = PaginatedRevenueByRecordingSchema( items=[RevenueByRecordingSchema( recording_id='1234', recording_title='Title', artist='Artist', version='Acoustic', isrc='JPYE70900611', account_id=57608, contract_id=None, account_payee_currency='JPY', net_share_payee_currency=8.00, gross_revenue_payee_currency=10.00 )], pagination=PaginationSchema( pagination_type=PAGINATION_TYPE_STANDARD, total_records=1 ) ) data = { 'items': [{ 'recording_id': '1234', 'recording_title': 'Title', 'artist': 'Artist', 'version': 'Acoustic', 'isrc': 'JPYE70900611', 'account_id': 57608, 'contract_id': None, 'account_payee_currency': 'JPY', 'net_share_payee_currency': 8.00, 'gross_revenue_payee_currency': 10.00 }], 'pagination': { 'pagination_type': PAGINATION_TYPE_STANDARD, 'total_records': 1 } } actual = PaginatedRevenueByRecordingSchema(**data) assert actual == expected def test_paginated_revenue_by_store_schema(): """Test getting paginated revenue by recording schema.""" expected = PaginatedRevenueByStoreSchema( items=[RevenueByStoreSchema( store_id=123, store_name='Spotify', account_payee_currency='USD', net_revenue_payee_currency=8008.00, gross_revenue_payee_currency=1120.00, )], totals=RevenuePayeeCurrencyTotalsSchema( net_revenue_payee_currency=22093.701372643944, gross_revenue_payee_currency=29988.667602314563 ), pagination=PaginationSchema( pagination_type=PAGINATION_TYPE_STANDARD, total_records=1, ) ) data = { 'items': [{ 'store_id': 123, 'store_name': 'Spotify', 'account_payee_currency': 'USD', 'net_revenue_payee_currency': 8008.00, 'gross_revenue_payee_currency': 1120.00, }], 'totals': { 'net_revenue_payee_currency': 22093.701372643944, 'gross_revenue_payee_currency': 29988.667602314563 }, 'pagination': { 'pagination_type': PAGINATION_TYPE_STANDARD, 'total_records': 1, } } actual = PaginatedRevenueByStoreSchema(**data) assert actual == expected def test_paginated_revenue_by_store_schema_with_zero_totals(): """Test getting paginated revenue by recording schema.""" expected = PaginatedRevenueByStoreSchema( items=[], totals=RevenuePayeeCurrencyTotalsSchema( net_revenue_payee_currency=None, gross_revenue_payee_currency=None ), pagination=PaginationSchema( pagination_type=PAGINATION_TYPE_STANDARD, total_records=0, ) ) data = { 'items': [], 'totals': { 'net_revenue_payee_currency': None, 'gross_revenue_payee_currency': None }, 'pagination': { 'pagination_type': PAGINATION_TYPE_STANDARD, 'total_records': 0, } } actual = PaginatedRevenueByStoreSchema(**data) assert actual == expected def test_paginated_revenue_by_project_schema(): """Test getting paginated revenue by project schema.""" expected = PaginatedRevenueByProjectSchema( items=[RevenueByProjectSchema( project_id=123, project_name='Project Nimbus', project_code='PN-001', project_artist='Nimbus Artist', product_count=2, account_payee_currency='USD', net_share_payee_currency=8008.00, gross_revenue_payee_currency=1120.00, )], pagination=PaginationSchema( pagination_type=PAGINATION_TYPE_STANDARD, total_records=1, ) ) data = { 'items': [{ 'project_id': 123, 'project_name': 'Project Nimbus', 'project_code': 'PN-001', 'project_artist': 'Nimbus Artist', 'product_count': 2, 'account_payee_currency': 'USD', 'net_share_payee_currency': 8008.00, 'gross_revenue_payee_currency': 1120.00, }], 'pagination': { 'pagination_type': PAGINATION_TYPE_STANDARD, 'total_records': 1, } } actual = PaginatedRevenueByProjectSchema(**data) assert actual == expected def test_paginated_revenue_by_product_schema(): """Test getting paginated revenue by product schema.""" expected = PaginatedRevenueByProductSchema( items=[RevenueByProductSchema( product_id=3842056, product_name='Product', display_upc='1111111111111', artist_name='Artist', release_date=datetime(2013, 2, 18, 0, 0), account_id=57608, contract_id=None, account_payee_currency='GBP', mechanical_deduction_amount_payee_currency=3.248464003404, publisher_admin_fee_payee_currency=-3, net_share_payee_currency=3.248464003404, gross_revenue_payee_currency=3.248464003404, )], pagination=PaginationSchema( pagination_type=PAGINATION_TYPE_STANDARD, total_records=1 ) ) data = { 'items': [{ 'product_id': 3842056, 'artist_name': 'Artist', 'product_name': 'Product', 'display_upc': '1111111111111', 'release_date': datetime(2013, 2, 18, 0, 0), 'account_id': 57608, 'contract_id': None, 'account_payee_currency': 'GBP', 'mechanical_deduction_amount_payee_currency': 3.248464003404, 'publisher_admin_fee_payee_currency': -3, 'net_share_payee_currency': 3.248464003404, 'gross_revenue_payee_currency': 3.248464003404, }], 'pagination': { 'pagination_type': PAGINATION_TYPE_STANDARD, 'total_records': 1 } } actual = PaginatedRevenueByProductSchema(**data) assert actual == expected def test_account_revenue_schema(): """Test account statement period schema.""" expected = AccountRevenueSchema( since_statement_period_id=285, currency_code='GBP', gross_revenue_payee_currency=3989.23, net_revenue_payee_currency=2989.23, subaccount_revenue=2989.23 ) data = { 'since_statement_period_id': 285, 'currency_code': 'GBP', 'gross_revenue_payee_currency': 3989.23, 'net_revenue_payee_currency': 2989.23, 'subaccount_revenue': 2989.23 } actual = AccountRevenueSchema(**data) assert actual == expected def test_revenue_by_country_schema(): """Test account statement period schema.""" expected = RevenueByCountrySchema( account_id=20434, account_payee_currency='GBP', country_code='US', gross_revenue_payee_currency=3989.23, net_revenue_payee_currency=2989.23, subaccount_revenue=2789.21, ) data = { 'account_id': 20434, 'account_payee_currency': 'GBP', 'country_code': 'US', 'gross_revenue_payee_currency': 3989.23, 'net_revenue_payee_currency': 2989.23, 'subaccount_revenue': 2789.21, } actual = RevenueByCountrySchema(**data) assert actual == expected def test_revenue_by_transaction_type_schema(): """Test revenue by transaction type schema.""" expected = RevenueByTransactionTypeSchema( transaction_type_id=4, transaction_type_desc='Downloaded Ringtones', transaction_type_group_name='Ringtones Group', account_payee_currency='USD', quantity=10, gross_revenue_payee_currency=3989.23, net_revenue_payee_currency=-2989.23, subaccount_revenue=3989.23 ) data = { 'transaction_type_id': 4, 'transaction_type_desc': 'Downloaded Ringtones', 'transaction_type_group_name': 'Ringtones Group', 'account_payee_currency': 'USD', 'quantity': 10, 'gross_revenue_payee_currency': 3989.23, 'net_revenue_payee_currency': -2989.23, 'subaccount_revenue': 3989.23 } actual = RevenueByTransactionTypeSchema(**data) assert actual == expected def test_account_statement_period_revenue_schema(): """Test revenue by account statement period schema.""" expected = AccountStatementPeriodRevenueSchema( currency_code='GBP', statement_period_name='August 2023', statement_period_id=296, statement_period_status=StatementPeriodStatus.CLOSED, gross_revenue_payee_currency=2311.23, net_revenue_payee_currency=4422.23, gross_publishing_revenue_payee_currency=0.0, net_publishing_revenue_payee_currency=512.34, subaccount_revenue=4422.23, ) data = { 'currency_code': 'GBP', 'statement_period_name': 'August 2023', 'statement_period_id': 296, 'statement_period_status': 'closed', 'gross_revenue_payee_currency': 2311.23, 'net_revenue_payee_currency': 4422.23, 'gross_publishing_revenue_payee_currency': 0.0, 'net_publishing_revenue_payee_currency': 512.34, 'subaccount_revenue': 4422.23 } actual = AccountStatementPeriodRevenueSchema(**data) assert actual == expected def test_revenue_by_track_schema(): """Test getting revenue by track schema.""" expected = RevenueByTrackSchema( track_unique_id=12341234, track_name='Best Name', product_name='Best product', format='Single', upc=1234123412341, isrc='IIIII1234187', mechanical_deduction_amount_payee_currency=100, publisher_admin_fee_payee_currency=-1, release_date='2010-09-08T00:00:00', primary_artist='Best Artist', featuring_artist=None, account_id=24601, account_payee_currency='JPY', project_name='Project Alpha', net_revenue_payee_currency=2311.23, gross_revenue_payee_currency=4422.23, subaccount_revenue=2.7483748374837 ) payload = { 'track_unique_id': 12341234, 'track_name': 'Best Name', 'product_name': 'Best product', 'format': 'Single', 'upc': 1234123412341, 'isrc': 'IIIII1234187', 'mechanical_deduction_amount_payee_currency': 100, 'publisher_admin_fee_payee_currency': -1, 'primary_artist': 'Best Artist', 'featuring_artist': None, 'account_id': 24601, 'release_date': '2010-09-08T00:00:00', 'account_payee_currency': 'JPY', 'project_name': 'Project Alpha', 'net_revenue_payee_currency': 2311.23, 'gross_revenue_payee_currency': 4422.23, 'subaccount_revenue': 2.7483748374837 } actual = RevenueByTrackSchema(**payload) assert actual == expected def test_paginated_revenue_by_track_schema(): """Test getting paginated revenue by track schema.""" expected = PaginatedRevenueByTrackSchema( items=[RevenueByTrackSchema( track_unique_id=12341234, track_name='Best Name', product_name='Best product', format='Single', upc=1234123412341, isrc='IIIII1234187', primary_artist='Best Artist', featuring_artist=None, account_id=24601, account_payee_currency='JPY', mechanical_deduction_amount_payee_currency=2311.23, publisher_admin_fee_payee_currency=-2, net_revenue_payee_currency=2311.23, gross_revenue_payee_currency=4422.23, )], pagination=PaginationSchema( pagination_type=PAGINATION_TYPE_STANDARD, total_records=1 ) ) data = { 'items': [{ 'track_unique_id': 12341234, 'track_name': 'Best Name', 'product_name': 'Best product', 'format': 'Single', 'upc': 1234123412341, 'isrc': 'IIIII1234187', 'primary_artist': 'Best Artist', 'featuring_artist': None, 'account_id': 24601, 'account_payee_currency': 'JPY', 'mechanical_deduction_amount_payee_currency': 2311.23, 'publisher_admin_fee_payee_currency': -2, 'net_revenue_payee_currency': 2311.23, 'gross_revenue_payee_currency': 4422.23 }], 'pagination': { 'pagination_type': PAGINATION_TYPE_STANDARD, 'total_records': 1 } } actual = PaginatedRevenueByTrackSchema(**data) assert actual == expected def test_revenue_by_artist_schema(): """Test getting revenue by artist schema.""" expected = RevenueByArtistSchema( artist_id=12345, artist_name='The Artist Formerly Known As Test Artist', account_id=24601, account_payee_currency='JPY', mechanical_deduction_amount_payee_currency=100, publisher_admin_fee_payee_currency=-1, net_revenue_payee_currency=2311.23, gross_revenue_payee_currency=4422.23, subaccount_id=1001, subaccount_revenue=231.12 ) payload = { 'artist_id': 12345, 'artist_name': 'The Artist Formerly Known As Test Artist', 'account_id': 24601, 'account_payee_currency': 'JPY', 'mechanical_deduction_amount_payee_currency': 100, 'publisher_admin_fee_payee_currency': -1, 'net_revenue_payee_currency': 2311.23, 'gross_revenue_payee_currency': 4422.23, 'subaccount_id': 1001, 'subaccount_revenue': 231.12 } actual = RevenueByArtistSchema(**payload) assert actual == expected def test_paginated_revenue_by_artist_schema(): """Test getting paginated revenue by artist schema.""" expected = PaginatedRevenueByArtistSchema( items=[RevenueByArtistSchema( artist_id=12345, artist_name='The Artist Formerly Known As Test Artist', account_id=24601, account_payee_currency='JPY', mechanical_deduction_amount_payee_currency=100, publisher_admin_fee_payee_currency=-1, net_revenue_payee_currency=2311.23, gross_revenue_payee_currency=4422.23, )], pagination=PaginationSchema( pagination_type=PAGINATION_TYPE_STANDARD, total_records=1 ) ) data = { 'items': [{ 'artist_id': 12345, 'artist_name': 'The Artist Formerly Known As Test Artist', 'account_id': 24601, 'account_payee_currency': 'JPY', 'mechanical_deduction_amount_payee_currency': 100, 'publisher_admin_fee_payee_currency': -1, 'net_revenue_payee_currency': 2311.23, 'gross_revenue_payee_currency': 4422.23 }], 'pagination': { 'pagination_type': PAGINATION_TYPE_STANDARD, 'total_records': 1 } } actual = PaginatedRevenueByArtistSchema(**data) assert actual == expected def test_paginated_revenue_by_imprint_schema(): """Test getting paginated revenue by imprint schema.""" expected = PaginatedRevenueByImprintSchema( items=[RevenueByImprintSchema( imprintid=123456, imprint='TEST IMPRINT', account_id=24601, account_payee_currency='JPY', mechanical_deduction_amount_payee_currency=100, publisher_admin_fee_payee_currency=-1, net_share_payee_currency=2311.23, gross_revenue_payee_currency=4422.23, subaccount_revenue=123 )], pagination=PaginationSchema( pagination_type=PAGINATION_TYPE_STANDARD, total_records=1 ) ) data = { 'items': [{ 'imprintid': 123456, 'imprint': 'TEST IMPRINT', 'account_id': 24601, 'account_payee_currency': 'JPY', 'mechanical_deduction_amount_payee_currency': 100, 'publisher_admin_fee_payee_currency': -1, 'net_share_payee_currency': 2311.23, 'gross_revenue_payee_currency': 4422.23, 'subaccount_revenue': 123 }], 'pagination': { 'pagination_type': PAGINATION_TYPE_STANDARD, 'total_records': 1 } } actual = PaginatedRevenueByImprintSchema(**data) assert actual == expected def test_paginated_revenue_by_subaccount_schema(): """Test getting paginated revenue by subaccount schema.""" expected = PaginatedRevenueBySubaccountSchema( items=[RevenueBySubaccountSchema( subaccount_id=111222, subaccount_name='Test Subaccount', account_id=24601, account_payee_currency='JPY', mechanical_deduction_amount_payee_currency=100, publisher_admin_fee_payee_currency=-1, net_revenue_payee_currency=2311.23, gross_revenue_payee_currency=4422.23, )], pagination=PaginationSchema( pagination_type=PAGINATION_TYPE_STANDARD, total_records=1 ) ) data = { 'items': [{ 'subaccount_id': 111222, 'subaccount_name': 'Test Subaccount', 'account_id': 24601, 'account_payee_currency': 'JPY', 'mechanical_deduction_amount_payee_currency': 100, 'publisher_admin_fee_payee_currency': -1, 'net_revenue_payee_currency': 2311.23, 'gross_revenue_payee_currency': 4422.23 }], 'pagination': { 'pagination_type': PAGINATION_TYPE_STANDARD, 'total_records': 1 } } actual = PaginatedRevenueBySubaccountSchema(**data) assert actual == expected def test_paginated_revenue_by_activity_month_schema(): """Test getting paginated revenue by activity month schema.""" expected = PaginatedRevenueByActivityMonthSchema( items=[ RevenueByActivityMonthSchema( account_payee_currency='JPY', activity_period_id=120, activity_month_name='July 2024', net_share_payee_currency=2311.23, gross_revenue_payee_currency=4422.23, net_publishing_revenue_payee_currency=123.45, gross_publishing_revenue_payee_currency=234.56, ) ], pagination=PaginationSchema( pagination_type=PAGINATION_TYPE_STANDARD, total_records=1 ) ) data = { 'items': [{ 'account_payee_currency': 'JPY', 'activity_month_name': 'July 2024', 'activity_period_id': 120, 'net_share_payee_currency': 2311.23, 'gross_revenue_payee_currency': 4422.23, 'net_publishing_revenue_payee_currency': 123.45, 'gross_publishing_revenue_payee_currency': 234.56, }], 'pagination': { 'pagination_type': PAGINATION_TYPE_STANDARD, 'total_records': 1 } } actual = PaginatedRevenueByActivityMonthSchema(**data) assert actual == expected def test_paginated_revenue_by_activity_month_schema_subaccount(): """Test getting paginated revenue by activity month schema with subaccount revenue.""" expected = PaginatedRevenueByActivityMonthSchema( items=[ RevenueByActivityMonthSchema( account_payee_currency='JPY', activity_period_id=120, activity_month_name='July 2024', net_share_payee_currency=2311.23, gross_revenue_payee_currency=4422.23, subaccount_revenue=123 ) ], pagination=PaginationSchema( pagination_type=PAGINATION_TYPE_STANDARD, total_records=1 ) ) data = { 'items': [{ 'account_payee_currency': 'JPY', 'activity_month_name': 'July 2024', 'activity_period_id': 120, 'net_share_payee_currency': 2311.23, 'gross_revenue_payee_currency': 4422.23, 'net_publishing_revenue_payee_currency': None, 'gross_publishing_revenue_payee_currency': None, 'subaccount_revenue': 123 }], 'pagination': { 'pagination_type': PAGINATION_TYPE_STANDARD, 'total_records': 1 } } actual = PaginatedRevenueByActivityMonthSchema(**data) assert actual == expected def test_transaction_type_schema(): """Test getting paginated revenue by activity month schema with subaccount revenue.""" expected = TransactionTypeSchema( transaction_type_id=120, transaction_type_desc='Ad Supported Audio Streams from Art Track Videos', transaction_type_group_name='Streaming - Digital Distribution', ) data = { 'transaction_type_id': 120, 'transaction_type_desc': 'Ad Supported Audio Streams from Art Track Videos', 'transaction_type_group_name': 'Streaming - Digital Distribution', } actual = TransactionTypeSchema(**data) assert actual == expected