File size: 728 Bytes
a0b7162
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""Tests for app.py module."""
import pytest
from google_play_scraper.features.app import app
from unittest.mock import patch, MagicMock


@patch('google_play_scraper.utils.http_utils.get')
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


@patch('google_play_scraper.utils.http_utils.get')
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")