Team Ai
Apppublic

Nouussair/attack-surface-mapper

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
test_parser.py36 linesDownload Raw Back to tests
1from pathlib import Path2 3from core.manifest_parser import parse_manifest4 5 6def test_parse_uses_permissions_and_fileprovider_metadata(tmp_path):7		manifest_xml = tmp_path / "AndroidManifest.xml"8		manifest_xml.write_text(9				"""<?xml version="1.0" encoding="utf-8"?>10<manifest xmlns:android="http://schemas.android.com/apk/res/android"11		package="com.example.app">12	<uses-permission android:name="android.permission.INTERNET" />13	<application>14		<provider15				android:name="androidx.core.content.FileProvider"16				android:authorities="com.example.app.provider">17			<meta-data18					android:name="android.support.FILE_PROVIDER_PATHS"19					android:resource="@xml/file_paths" />20		</provider>21	</application>22</manifest>23""",24				encoding="utf-8",25		)26 27		manifest = parse_manifest(str(manifest_xml))28 29		assert manifest.uses_permissions == ["android.permission.INTERNET"]30		assert len(manifest.providers) == 131		provider = manifest.providers[0]32		assert provider.is_file_provider is True33		assert len(provider.meta_data) == 134		assert provider.meta_data[0].name == "android.support.FILE_PROVIDER_PATHS"35		assert provider.meta_data[0].resource == "@xml/file_paths"36