"""Test for the stats logic.""" from unittest.mock import patch from socials.logic import stats as stats_logic account_id = 569002 identity_id = '6d7d12e7-1158-4c4f-a5ac-96275605d212' @patch('socials.models.pending.get_pending_social_accounts') @patch('socials.models.stats.get_stats_by_account') def test_get_stats_by_account( mock_stats, mock_pending_socials ): """Test get_stats_by_account.""" mock_pending_socials.return_value = [{ 'platform': 'instagram', 'url': 'https://instagram.com/jfouling' }] mock_stats.return_value = [{ 'platform': 'instagram', 'url': 'https://instagram.com/jacobfowler' }] result = stats_logic.get_stats_by_account( account_id, identity_id) assert result.message == [{ 'platform': 'instagram', 'url': 'https://instagram.com/jacobfowler', 'pendingUrl': 'https://instagram.com/jfouling' }]