| """Tests for app.py module.""" | |
| import pytest | |
| from google_play_scraper.features.app import app | |
| from unittest.mock import patch, MagicMock | |
| def test_app_success(mock_get): | |
| mock_get.return_value = { | |
| "title": "Test App", | |
| "rating": 4.5, | |
| "installs": "1,000,000+" | |
| } | |
| result = app("com.test.app") | |
| assert result["title"] == "Test App" | |
| assert result["rating"] == 4.5 | |
| def test_app_not_found(mock_get): | |
| from google_play_scraper.exceptions import NotFoundError | |
| mock_get.side_effect = NotFoundError("App not found") | |
| with pytest.raises(NotFoundError): | |
| app("com.notfound.app") |