"""Test the content review account blocklist model.""" from unittest.mock import call from owsresponse import response import pytest from pythonfeatures import pythonfeatures from product_digital.models import content_review_account_blocklist @pytest.mark.parametrize( ( 'test_description', 'get_single_feature_by_attributes_response', 'expected_result', ), [ ( 'Error checking if account is on blocklist', response.Response('some error occurred', status=500), response.Response('some error occurred', status=500), ), ( 'Account is on blocklist', response.Response('enabled'), response.Response(True), ), ( 'Account is not on blocklist', response.Response('control'), response.Response(False), ), ], ) def test_is_vendor_or_subaccount_on_blocklist( mocker, test_description, get_single_feature_by_attributes_response, expected_result, ): """Test is_vendor_or_subaccount_on_blocklist.""" mocker.patch.object( pythonfeatures, 'get_single_feature_by_attributes', return_value=get_single_feature_by_attributes_response, ) result = content_review_account_blocklist.is_vendor_or_subaccount_on_blocklist( vendor_id=123, subaccount_id=456, ) assert pythonfeatures.get_single_feature_by_attributes.mock_calls == [ call('content_review_account_blocklist', {'vendor_id': 123, 'subaccount_id': 456}) ] assert result.status == expected_result.status assert result.message == expected_result.message