flutter-dev 0.1.11__tar.gz → 0.1.12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/CHANGELOG.md +10 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/PKG-INFO +4 -4
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/README.md +3 -3
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/fdev.py +1 -1
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/managers/app.py +37 -31
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/pyproject.toml +1 -1
- flutter_dev-0.1.12/tests/test_app_commands.py +161 -0
- flutter_dev-0.1.11/tests/test_app_commands.py +0 -66
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/.env.example +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/LICENSE +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/MANIFEST.in +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/common_utils.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/core/__init__.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/core/ai_config.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/core/constants.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/core/state.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/create_page.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/flutter_dev.egg-info/SOURCES.txt +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/gemini_api.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/git_diff_output_editor.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/install_legacy.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/managers/__init__.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/managers/ai.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/managers/brew.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/managers/build.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/managers/datetime.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/managers/device.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/managers/doctor.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/managers/git.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/managers/git_account.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/managers/localization.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/managers/merge.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/managers/mirror.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/managers/package.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/managers/project.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/managers/web_deploy.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/requirements.txt +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/setup.cfg +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/setup.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/switch_ai.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/tests/test_ai_config.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/tests/test_fdev_cli.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/tests/test_localization.py +0 -0
- {flutter_dev-0.1.11 → flutter_dev-0.1.12}/tests/test_package_commands.py +0 -0
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
|
+
## 0.1.12 - 2026-07-22
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Updated the PyPI workflow to use Node.js 24-native `actions/upload-artifact@v7`.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Fixed `fdev clear-data` to verify that the current project app is installed before clearing it, and to fall back to a confirmed foreground-app clear when the project app is missing or the direct clear fails.
|
|
14
|
+
|
|
5
15
|
## 0.1.11 - 2026-07-22
|
|
6
16
|
|
|
7
17
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flutter-dev
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.12
|
|
4
4
|
Summary: A cross-platform CLI toolkit for Flutter development workflows.
|
|
5
5
|
Author: Royal Court BD
|
|
6
6
|
License-Expression: MIT
|
|
@@ -42,7 +42,7 @@ The package is published on PyPI as `flutter-dev` and installs console commands
|
|
|
42
42
|
python -m pip install flutter-dev
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
Current package metadata declares version `0.1.
|
|
45
|
+
Current package metadata declares version `0.1.12`, Python `>=3.8`, MIT license, and support for macOS, Linux, and Windows.
|
|
46
46
|
|
|
47
47
|
## Key Features
|
|
48
48
|
|
|
@@ -201,7 +201,7 @@ Android APK/AAB build commands rename output files using the Android app label a
|
|
|
201
201
|
| --- | --- |
|
|
202
202
|
| `fdev install` | Installs a built APK from `build/app/outputs/flutter-apk`, prefers `arm64-v8a`, retries after uninstall on failure, then launches the app. |
|
|
203
203
|
| `fdev uninstall` | In a Flutter project root, uninstalls by package/bundle id. Outside a project, detects the foreground app and asks for confirmation. |
|
|
204
|
-
| `fdev clear-data` | In a Flutter project root, clears the project's Android package data without confirmation
|
|
204
|
+
| `fdev clear-data` | In a Flutter project root, clears the installed project's Android package data without confirmation; if it is missing or the clear fails, falls back to the foreground app with a default-Yes safety prompt. Outside a project, always detects and confirms the foreground app. iOS prints manual options. |
|
|
205
205
|
| `fdev install-scrcpy` | Installs `scrcpy` using the best supported package manager for the current platform. |
|
|
206
206
|
| `fdev mirror` | Launches `scrcpy` for a selected Android device. |
|
|
207
207
|
| `fdev mirror --wireless` | Guides wireless ADB setup using a USB-connected Android device. |
|
|
@@ -413,7 +413,7 @@ The installed Python layout is top-level modules plus the `core` and `managers`
|
|
|
413
413
|
- `fdev tag` updates `pubspec.yaml`, creates a commit, creates a Git tag, and pushes both.
|
|
414
414
|
- `fdev discard` removes tracked changes and untracked files after confirmation.
|
|
415
415
|
- `fdev cleanup` applies `dart fix`, formats the project, and runs a major-version dependency upgrade.
|
|
416
|
-
- `fdev clear-data`
|
|
416
|
+
- `fdev clear-data` clears the installed current project's Android package without confirmation when run from a Flutter project root. If that package is missing or cannot be cleared, and whenever the command runs outside a project, it targets the foreground app after a default-Yes `[Y/n]` confirmation.
|
|
417
417
|
- `fdev uninstall` may fall back to foreground app detection outside a Flutter project root.
|
|
418
418
|
- `fdev upgrade` and `fdev delete` manage the local `flutter-dev` Python package, not the Flutter app on a device.
|
|
419
419
|
- `fdev upgrade` reports the installed version and location before upgrading, then shows the before→after version when the active process can verify it immediately.
|
|
@@ -8,7 +8,7 @@ The package is published on PyPI as `flutter-dev` and installs console commands
|
|
|
8
8
|
python -m pip install flutter-dev
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
Current package metadata declares version `0.1.
|
|
11
|
+
Current package metadata declares version `0.1.12`, Python `>=3.8`, MIT license, and support for macOS, Linux, and Windows.
|
|
12
12
|
|
|
13
13
|
## Key Features
|
|
14
14
|
|
|
@@ -167,7 +167,7 @@ Android APK/AAB build commands rename output files using the Android app label a
|
|
|
167
167
|
| --- | --- |
|
|
168
168
|
| `fdev install` | Installs a built APK from `build/app/outputs/flutter-apk`, prefers `arm64-v8a`, retries after uninstall on failure, then launches the app. |
|
|
169
169
|
| `fdev uninstall` | In a Flutter project root, uninstalls by package/bundle id. Outside a project, detects the foreground app and asks for confirmation. |
|
|
170
|
-
| `fdev clear-data` | In a Flutter project root, clears the project's Android package data without confirmation
|
|
170
|
+
| `fdev clear-data` | In a Flutter project root, clears the installed project's Android package data without confirmation; if it is missing or the clear fails, falls back to the foreground app with a default-Yes safety prompt. Outside a project, always detects and confirms the foreground app. iOS prints manual options. |
|
|
171
171
|
| `fdev install-scrcpy` | Installs `scrcpy` using the best supported package manager for the current platform. |
|
|
172
172
|
| `fdev mirror` | Launches `scrcpy` for a selected Android device. |
|
|
173
173
|
| `fdev mirror --wireless` | Guides wireless ADB setup using a USB-connected Android device. |
|
|
@@ -379,7 +379,7 @@ The installed Python layout is top-level modules plus the `core` and `managers`
|
|
|
379
379
|
- `fdev tag` updates `pubspec.yaml`, creates a commit, creates a Git tag, and pushes both.
|
|
380
380
|
- `fdev discard` removes tracked changes and untracked files after confirmation.
|
|
381
381
|
- `fdev cleanup` applies `dart fix`, formats the project, and runs a major-version dependency upgrade.
|
|
382
|
-
- `fdev clear-data`
|
|
382
|
+
- `fdev clear-data` clears the installed current project's Android package without confirmation when run from a Flutter project root. If that package is missing or cannot be cleared, and whenever the command runs outside a project, it targets the foreground app after a default-Yes `[Y/n]` confirmation.
|
|
383
383
|
- `fdev uninstall` may fall back to foreground app detection outside a Flutter project root.
|
|
384
384
|
- `fdev upgrade` and `fdev delete` manage the local `flutter-dev` Python package, not the Flutter app on a device.
|
|
385
385
|
- `fdev upgrade` reports the installed version and location before upgrading, then shows the before→after version when the active process can verify it immediately.
|
|
@@ -102,7 +102,7 @@ def show_usage(exit_code=1):
|
|
|
102
102
|
print(f"\n{BLUE}Device Commands:{NC}")
|
|
103
103
|
print(" install Install built APK on connected device")
|
|
104
104
|
print(" uninstall Uninstall app from connected device")
|
|
105
|
-
print(" clear-data Clear project app data
|
|
105
|
+
print(" clear-data Clear project app data with confirmed foreground fallback")
|
|
106
106
|
print(" install-scrcpy Install scrcpy for Android screen mirroring")
|
|
107
107
|
print(" mirror Launch scrcpy screen mirror (auto-detect device)")
|
|
108
108
|
print(" --wireless Setup wireless ADB connection")
|
|
@@ -188,14 +188,15 @@ def clear_app_data():
|
|
|
188
188
|
"""
|
|
189
189
|
Clear app data from a connected device.
|
|
190
190
|
|
|
191
|
-
In a Flutter project root, clear the project's Android package
|
|
192
|
-
confirmation
|
|
193
|
-
|
|
191
|
+
In a Flutter project root, clear the project's installed Android package
|
|
192
|
+
without confirmation. If it is not installed or cannot be cleared, fall
|
|
193
|
+
back to the foreground app with confirmation. Outside a project root,
|
|
194
|
+
always detect and confirm before clearing the foreground app.
|
|
194
195
|
"""
|
|
195
196
|
print(f"{YELLOW}Clearing app data...{NC}\n")
|
|
196
197
|
|
|
197
|
-
# Match uninstall behavior in a Flutter project: target the
|
|
198
|
-
# package
|
|
198
|
+
# Match uninstall behavior in a Flutter project: target the installed
|
|
199
|
+
# project package first, then fall back to the foreground app if needed.
|
|
199
200
|
if is_flutter_project_root() and get_all_connected_devices():
|
|
200
201
|
print(f"{GREEN}✓ Flutter project detected{NC}\n")
|
|
201
202
|
print(f"{BLUE}Android device detected{NC}")
|
|
@@ -210,21 +211,40 @@ def clear_app_data():
|
|
|
210
211
|
|
|
211
212
|
print(f"{BLUE}Package name: {package_name}{NC}\n")
|
|
212
213
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
214
|
+
if is_app_installed(package_name):
|
|
215
|
+
print(f"{GREEN}✓ App is installed on device{NC}\n")
|
|
216
|
+
success = _clear_android_package_data(package_name)
|
|
217
|
+
if success:
|
|
218
|
+
return True
|
|
217
219
|
|
|
218
|
-
|
|
219
|
-
print(f"\n{GREEN}✓ App data cleared successfully!{NC}")
|
|
220
|
-
print(f"{BLUE}You can now relaunch the app from the device{NC}")
|
|
220
|
+
print(f"\n{YELLOW}⚠️ Could not clear data for {package_name}{NC}")
|
|
221
221
|
else:
|
|
222
|
-
print(f"
|
|
223
|
-
print(f"{YELLOW}Make sure the app package name is correct{NC}")
|
|
222
|
+
print(f"{YELLOW}⚠️ Project app is not installed on device{NC}")
|
|
224
223
|
|
|
225
|
-
|
|
224
|
+
print(f"{YELLOW} Detecting foreground app instead...{NC}\n")
|
|
226
225
|
|
|
227
|
-
|
|
226
|
+
return _clear_foreground_app_data()
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
def _clear_android_package_data(package_name):
|
|
230
|
+
"""Clear one Android package and report the command result."""
|
|
231
|
+
success = run_flutter_command(
|
|
232
|
+
build_adb_cmd(["shell", "pm", "clear", package_name]),
|
|
233
|
+
"Clearing app data... ",
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
if success:
|
|
237
|
+
print(f"\n{GREEN}✓ App data cleared successfully!{NC}")
|
|
238
|
+
print(f"{BLUE}You can now relaunch the app from the device{NC}")
|
|
239
|
+
else:
|
|
240
|
+
print(f"\n{RED}✗ Failed to clear app data!{NC}")
|
|
241
|
+
print(f"{YELLOW}Make sure the app package name is correct{NC}")
|
|
242
|
+
|
|
243
|
+
return success
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def _clear_foreground_app_data():
|
|
247
|
+
"""Detect the foreground app and clear it only after confirmation."""
|
|
228
248
|
platform_type, package_name = get_current_foreground_app()
|
|
229
249
|
|
|
230
250
|
if not platform_type:
|
|
@@ -247,22 +267,8 @@ def clear_app_data():
|
|
|
247
267
|
print(f"{YELLOW}Operation cancelled{NC}")
|
|
248
268
|
return False
|
|
249
269
|
|
|
250
|
-
# Clear data based on platform
|
|
251
270
|
if platform_type == "android":
|
|
252
|
-
|
|
253
|
-
success = run_flutter_command(
|
|
254
|
-
build_adb_cmd(["shell", "pm", "clear", package_name]),
|
|
255
|
-
f"Clearing app data... "
|
|
256
|
-
)
|
|
257
|
-
|
|
258
|
-
if success:
|
|
259
|
-
print(f"\n{GREEN}✓ App data cleared successfully!{NC}")
|
|
260
|
-
print(f"{BLUE}You can now relaunch the app from the device{NC}")
|
|
261
|
-
else:
|
|
262
|
-
print(f"\n{RED}✗ Failed to clear app data!{NC}")
|
|
263
|
-
print(f"{YELLOW}Make sure the app package name is correct{NC}")
|
|
264
|
-
|
|
265
|
-
return success
|
|
271
|
+
return _clear_android_package_data(package_name)
|
|
266
272
|
|
|
267
273
|
elif platform_type == "ios":
|
|
268
274
|
# iOS doesn't support direct app data clearing via command line
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from unittest.mock import patch
|
|
3
|
+
|
|
4
|
+
from managers import app
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ClearAppDataTests(unittest.TestCase):
|
|
8
|
+
def test_project_root_clears_project_package_without_confirmation(self):
|
|
9
|
+
with (
|
|
10
|
+
patch.object(app, "is_flutter_project_root", return_value=True),
|
|
11
|
+
patch.object(app, "get_all_connected_devices", return_value=["device-1"]),
|
|
12
|
+
patch.object(app, "ensure_device_connected", return_value=True),
|
|
13
|
+
patch.object(app, "get_package_name", return_value="com.example.app"),
|
|
14
|
+
patch.object(app, "is_app_installed", return_value=True),
|
|
15
|
+
patch.object(
|
|
16
|
+
app,
|
|
17
|
+
"build_adb_cmd",
|
|
18
|
+
return_value=["adb", "shell", "pm", "clear", "com.example.app"],
|
|
19
|
+
),
|
|
20
|
+
patch.object(app, "run_flutter_command", return_value=True) as run_command,
|
|
21
|
+
patch.object(app, "get_current_foreground_app") as foreground_app,
|
|
22
|
+
patch("builtins.input") as user_input,
|
|
23
|
+
):
|
|
24
|
+
result = app.clear_app_data()
|
|
25
|
+
|
|
26
|
+
self.assertTrue(result)
|
|
27
|
+
foreground_app.assert_not_called()
|
|
28
|
+
user_input.assert_not_called()
|
|
29
|
+
run_command.assert_called_once_with(
|
|
30
|
+
["adb", "shell", "pm", "clear", "com.example.app"],
|
|
31
|
+
"Clearing app data... ",
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
def test_missing_project_app_falls_back_to_confirmed_foreground_app(self):
|
|
35
|
+
with (
|
|
36
|
+
patch.object(app, "is_flutter_project_root", return_value=True),
|
|
37
|
+
patch.object(app, "get_all_connected_devices", return_value=["device-1"]),
|
|
38
|
+
patch.object(app, "ensure_device_connected", return_value=True),
|
|
39
|
+
patch.object(app, "get_package_name", return_value="com.example.app"),
|
|
40
|
+
patch.object(app, "is_app_installed", return_value=False),
|
|
41
|
+
patch.object(
|
|
42
|
+
app,
|
|
43
|
+
"get_current_foreground_app",
|
|
44
|
+
return_value=("android", "com.example.foreground"),
|
|
45
|
+
) as foreground_app,
|
|
46
|
+
patch.object(
|
|
47
|
+
app,
|
|
48
|
+
"build_adb_cmd",
|
|
49
|
+
return_value=[
|
|
50
|
+
"adb",
|
|
51
|
+
"shell",
|
|
52
|
+
"pm",
|
|
53
|
+
"clear",
|
|
54
|
+
"com.example.foreground",
|
|
55
|
+
],
|
|
56
|
+
),
|
|
57
|
+
patch.object(app, "run_flutter_command", return_value=True) as run_command,
|
|
58
|
+
patch("builtins.input", return_value="") as user_input,
|
|
59
|
+
):
|
|
60
|
+
result = app.clear_app_data()
|
|
61
|
+
|
|
62
|
+
self.assertTrue(result)
|
|
63
|
+
foreground_app.assert_called_once_with()
|
|
64
|
+
user_input.assert_called_once()
|
|
65
|
+
run_command.assert_called_once_with(
|
|
66
|
+
["adb", "shell", "pm", "clear", "com.example.foreground"],
|
|
67
|
+
"Clearing app data... ",
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
def test_failed_project_clear_falls_back_to_confirmed_foreground_app(self):
|
|
71
|
+
def adb_command(parts):
|
|
72
|
+
return ["adb", *parts]
|
|
73
|
+
|
|
74
|
+
with (
|
|
75
|
+
patch.object(app, "is_flutter_project_root", return_value=True),
|
|
76
|
+
patch.object(app, "get_all_connected_devices", return_value=["device-1"]),
|
|
77
|
+
patch.object(app, "ensure_device_connected", return_value=True),
|
|
78
|
+
patch.object(app, "get_package_name", return_value="com.example.app"),
|
|
79
|
+
patch.object(app, "is_app_installed", return_value=True),
|
|
80
|
+
patch.object(
|
|
81
|
+
app,
|
|
82
|
+
"get_current_foreground_app",
|
|
83
|
+
return_value=("android", "com.example.foreground"),
|
|
84
|
+
),
|
|
85
|
+
patch.object(app, "build_adb_cmd", side_effect=adb_command),
|
|
86
|
+
patch.object(
|
|
87
|
+
app,
|
|
88
|
+
"run_flutter_command",
|
|
89
|
+
side_effect=[False, True],
|
|
90
|
+
) as run_command,
|
|
91
|
+
patch("builtins.input", return_value="") as user_input,
|
|
92
|
+
):
|
|
93
|
+
result = app.clear_app_data()
|
|
94
|
+
|
|
95
|
+
self.assertTrue(result)
|
|
96
|
+
user_input.assert_called_once()
|
|
97
|
+
self.assertEqual(run_command.call_count, 2)
|
|
98
|
+
self.assertEqual(
|
|
99
|
+
run_command.call_args_list[0].args[0],
|
|
100
|
+
["adb", "shell", "pm", "clear", "com.example.app"],
|
|
101
|
+
)
|
|
102
|
+
self.assertEqual(
|
|
103
|
+
run_command.call_args_list[1].args[0],
|
|
104
|
+
["adb", "shell", "pm", "clear", "com.example.foreground"],
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
def test_missing_project_app_foreground_fallback_can_be_cancelled(self):
|
|
108
|
+
with (
|
|
109
|
+
patch.object(app, "is_flutter_project_root", return_value=True),
|
|
110
|
+
patch.object(app, "get_all_connected_devices", return_value=["device-1"]),
|
|
111
|
+
patch.object(app, "ensure_device_connected", return_value=True),
|
|
112
|
+
patch.object(app, "get_package_name", return_value="com.example.app"),
|
|
113
|
+
patch.object(app, "is_app_installed", return_value=False),
|
|
114
|
+
patch.object(
|
|
115
|
+
app,
|
|
116
|
+
"get_current_foreground_app",
|
|
117
|
+
return_value=("android", "com.example.foreground"),
|
|
118
|
+
),
|
|
119
|
+
patch.object(app, "run_flutter_command") as run_command,
|
|
120
|
+
patch("builtins.input", return_value="n") as user_input,
|
|
121
|
+
):
|
|
122
|
+
result = app.clear_app_data()
|
|
123
|
+
|
|
124
|
+
self.assertFalse(result)
|
|
125
|
+
user_input.assert_called_once()
|
|
126
|
+
run_command.assert_not_called()
|
|
127
|
+
|
|
128
|
+
def test_outside_project_confirms_before_clearing_foreground_app(self):
|
|
129
|
+
with (
|
|
130
|
+
patch.object(app, "is_flutter_project_root", return_value=False),
|
|
131
|
+
patch.object(
|
|
132
|
+
app,
|
|
133
|
+
"get_current_foreground_app",
|
|
134
|
+
return_value=("android", "com.example.foreground"),
|
|
135
|
+
),
|
|
136
|
+
patch.object(
|
|
137
|
+
app,
|
|
138
|
+
"build_adb_cmd",
|
|
139
|
+
return_value=[
|
|
140
|
+
"adb",
|
|
141
|
+
"shell",
|
|
142
|
+
"pm",
|
|
143
|
+
"clear",
|
|
144
|
+
"com.example.foreground",
|
|
145
|
+
],
|
|
146
|
+
),
|
|
147
|
+
patch.object(app, "run_flutter_command", return_value=True) as run_command,
|
|
148
|
+
patch("builtins.input", return_value="") as user_input,
|
|
149
|
+
):
|
|
150
|
+
result = app.clear_app_data()
|
|
151
|
+
|
|
152
|
+
self.assertTrue(result)
|
|
153
|
+
user_input.assert_called_once()
|
|
154
|
+
run_command.assert_called_once_with(
|
|
155
|
+
["adb", "shell", "pm", "clear", "com.example.foreground"],
|
|
156
|
+
"Clearing app data... ",
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
if __name__ == "__main__":
|
|
161
|
+
unittest.main()
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import unittest
|
|
2
|
-
from unittest.mock import patch
|
|
3
|
-
|
|
4
|
-
from managers import app
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class ClearAppDataTests(unittest.TestCase):
|
|
8
|
-
def test_project_root_clears_project_package_without_confirmation(self):
|
|
9
|
-
with (
|
|
10
|
-
patch.object(app, "is_flutter_project_root", return_value=True),
|
|
11
|
-
patch.object(app, "get_all_connected_devices", return_value=["device-1"]),
|
|
12
|
-
patch.object(app, "ensure_device_connected", return_value=True),
|
|
13
|
-
patch.object(app, "get_package_name", return_value="com.example.app"),
|
|
14
|
-
patch.object(
|
|
15
|
-
app,
|
|
16
|
-
"build_adb_cmd",
|
|
17
|
-
return_value=["adb", "shell", "pm", "clear", "com.example.app"],
|
|
18
|
-
),
|
|
19
|
-
patch.object(app, "run_flutter_command", return_value=True) as run_command,
|
|
20
|
-
patch.object(app, "get_current_foreground_app") as foreground_app,
|
|
21
|
-
patch("builtins.input") as user_input,
|
|
22
|
-
):
|
|
23
|
-
result = app.clear_app_data()
|
|
24
|
-
|
|
25
|
-
self.assertTrue(result)
|
|
26
|
-
foreground_app.assert_not_called()
|
|
27
|
-
user_input.assert_not_called()
|
|
28
|
-
run_command.assert_called_once_with(
|
|
29
|
-
["adb", "shell", "pm", "clear", "com.example.app"],
|
|
30
|
-
"Clearing app data... ",
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
def test_outside_project_confirms_before_clearing_foreground_app(self):
|
|
34
|
-
with (
|
|
35
|
-
patch.object(app, "is_flutter_project_root", return_value=False),
|
|
36
|
-
patch.object(
|
|
37
|
-
app,
|
|
38
|
-
"get_current_foreground_app",
|
|
39
|
-
return_value=("android", "com.example.foreground"),
|
|
40
|
-
),
|
|
41
|
-
patch.object(
|
|
42
|
-
app,
|
|
43
|
-
"build_adb_cmd",
|
|
44
|
-
return_value=[
|
|
45
|
-
"adb",
|
|
46
|
-
"shell",
|
|
47
|
-
"pm",
|
|
48
|
-
"clear",
|
|
49
|
-
"com.example.foreground",
|
|
50
|
-
],
|
|
51
|
-
),
|
|
52
|
-
patch.object(app, "run_flutter_command", return_value=True) as run_command,
|
|
53
|
-
patch("builtins.input", return_value="") as user_input,
|
|
54
|
-
):
|
|
55
|
-
result = app.clear_app_data()
|
|
56
|
-
|
|
57
|
-
self.assertTrue(result)
|
|
58
|
-
user_input.assert_called_once()
|
|
59
|
-
run_command.assert_called_once_with(
|
|
60
|
-
["adb", "shell", "pm", "clear", "com.example.foreground"],
|
|
61
|
-
"Clearing app data... ",
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if __name__ == "__main__":
|
|
66
|
-
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|