diff --git a/.auto-claude-status b/.auto-claude-status new file mode 100644 index 0000000..09becb6 --- /dev/null +++ b/.auto-claude-status @@ -0,0 +1,25 @@ +{ + "active": true, + "spec": "007-https-nordabiznes-pl-audit-gbp-inpi-dane-nie-sa-w-", + "state": "building", + "subtasks": { + "completed": 7, + "total": 14, + "in_progress": 1, + "failed": 0 + }, + "phase": { + "current": "Unit and Integration Tests", + "id": null, + "total": 4 + }, + "workers": { + "active": 0, + "max": 1 + }, + "session": { + "number": 8, + "started_at": "2026-01-08T20:23:31.762031" + }, + "last_update": "2026-01-08T20:36:12.863042" +} \ No newline at end of file diff --git a/tests/test_social_media_audit.py b/tests/test_social_media_audit.py index 9e3a1a4..45d4ce0 100644 --- a/tests/test_social_media_audit.py +++ b/tests/test_social_media_audit.py @@ -730,6 +730,50 @@ class TestBraveSearcherGoogleReviews(unittest.TestCase): """Set up test with BraveSearcher instance.""" self.searcher = BraveSearcher(api_key='test_brave_api_key') + @patch.dict('os.environ', {'GOOGLE_PLACES_API_KEY': 'test_places_key'}) + @patch.object(GooglePlacesSearcher, 'find_place') + @patch.object(GooglePlacesSearcher, 'get_place_details') + def test_search_google_reviews(self, mock_details, mock_find): + """Test successful Google reviews retrieval via Places API.""" + # Mock successful place lookup + mock_find.return_value = 'ChIJN1t_tDeuEmsRUsoyG83frY4' + + # Mock complete place details response + mock_details.return_value = { + 'google_rating': 4.7, + 'google_reviews_count': 156, + 'opening_hours': { + 'weekday_text': [ + 'Monday: 8:00 AM – 5:00 PM', + 'Tuesday: 8:00 AM – 5:00 PM', + 'Wednesday: 8:00 AM – 5:00 PM', + 'Thursday: 8:00 AM – 5:00 PM', + 'Friday: 8:00 AM – 4:00 PM', + 'Saturday: Closed', + 'Sunday: Closed', + ], + 'open_now': True, + 'periods': [], + }, + 'business_status': 'OPERATIONAL', + 'formatted_phone': '+48 58 123 4567', + 'website': 'https://example.com', + } + + result = self.searcher.search_google_reviews('Test Company Sp. z o.o.', 'Wejherowo') + + # Verify all fields are correctly returned + self.assertEqual(result['google_rating'], 4.7) + self.assertEqual(result['google_reviews_count'], 156) + self.assertIsNotNone(result['opening_hours']) + self.assertTrue(result['opening_hours']['open_now']) + self.assertEqual(len(result['opening_hours']['weekday_text']), 7) + self.assertEqual(result['business_status'], 'OPERATIONAL') + + # Verify correct API calls were made + mock_find.assert_called_once_with('Test Company Sp. z o.o.', 'Wejherowo') + mock_details.assert_called_once_with('ChIJN1t_tDeuEmsRUsoyG83frY4') + @patch.dict('os.environ', {'GOOGLE_PLACES_API_KEY': 'test_places_key'}) @patch.object(GooglePlacesSearcher, 'find_place') @patch.object(GooglePlacesSearcher, 'get_place_details')