flyshell 1.1.8__tar.gz → 1.1.9__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.
- {flyshell-1.1.8/src/flyshell.egg-info → flyshell-1.1.9}/PKG-INFO +1 -1
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell/constants.py +2 -2
- {flyshell-1.1.8 → flyshell-1.1.9/src/flyshell.egg-info}/PKG-INFO +1 -1
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell.egg-info/SOURCES.txt +2 -1
- flyshell-1.1.9/tests/test_utils.py +72 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/LICENSE +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/README.md +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/pyproject.toml +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/setup.cfg +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell/__init__.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell/abstract/__init__.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell/abstract/base_cmd.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell/abstract/base_plugin.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell/abstract/parent_cmd.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell/builtin/__init__.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell/builtin/diskops.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell/builtin/fs.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell/builtin/system.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell/builtin/utils.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell/core/__init__.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell/core/auth.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell/core/console.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell/core/data.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell/core/directory.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell/core/loader.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell/main.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell.egg-info/dependency_links.txt +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell.egg-info/entry_points.txt +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell.egg-info/requires.txt +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/src/flyshell.egg-info/top_level.txt +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/tests/test_auth.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/tests/test_data.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/tests/test_directory.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/tests/test_diskops.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/tests/test_loader.py +0 -0
- {flyshell-1.1.8 → flyshell-1.1.9}/tests/test_security.py +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# tests\test_utils.py
|
|
2
|
+
|
|
3
|
+
from flyshell.builtin import utils
|
|
4
|
+
from flyshell.core import data
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_echo_output_and_escape_characters():
|
|
8
|
+
cmd = utils.Echo()
|
|
9
|
+
code, msg = cmd.execute(["Hello", "World"])
|
|
10
|
+
assert code == 0
|
|
11
|
+
assert "Hello World" in msg
|
|
12
|
+
code, msg = cmd.execute([r"Line1\nLine2"])
|
|
13
|
+
assert code == 0
|
|
14
|
+
assert "Line1\nLine2" in msg
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_clear_returns_escape_code():
|
|
18
|
+
cmd = utils.Clear()
|
|
19
|
+
code, msg = cmd.execute([])
|
|
20
|
+
assert code == 0
|
|
21
|
+
assert msg == "\033[H\033[2J"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_sleep_validations():
|
|
25
|
+
cmd = utils.Sleep()
|
|
26
|
+
code, msg = cmd.execute(["not_a_number"])
|
|
27
|
+
assert code == 1
|
|
28
|
+
assert "Invalid argument" in msg
|
|
29
|
+
code, msg = cmd.execute([])
|
|
30
|
+
assert code == 1
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def test_history_limit_and_all_args(tmp_path, monkeypatch):
|
|
34
|
+
test_db = tmp_path / "test.db"
|
|
35
|
+
monkeypatch.setattr(
|
|
36
|
+
data,
|
|
37
|
+
"get_history",
|
|
38
|
+
lambda limit=None, filename=test_db: (
|
|
39
|
+
data.get_history.__wrapped__(limit=limit, filename=test_db)
|
|
40
|
+
if hasattr(data.get_history, "__wrapped__")
|
|
41
|
+
else [
|
|
42
|
+
entry
|
|
43
|
+
for entry in (
|
|
44
|
+
lambda conn: [
|
|
45
|
+
{"command": r[0], "timestamp": r[1]}
|
|
46
|
+
for r in conn.execute(
|
|
47
|
+
"SELECT command, timestamp FROM cmd_history ORDER BY id DESC LIMIT ?"
|
|
48
|
+
if limit and limit > 0
|
|
49
|
+
else "SELECT command, timestamp FROM cmd_history ORDER BY id ASC",
|
|
50
|
+
(limit,) if limit and limit > 0 else (),
|
|
51
|
+
).fetchall()
|
|
52
|
+
]
|
|
53
|
+
)(data._get_connection(test_db))
|
|
54
|
+
][::-1] if limit and limit > 0 else [
|
|
55
|
+
{"command": r[0], "timestamp": r[1]}
|
|
56
|
+
for r in data._get_connection(test_db).execute(
|
|
57
|
+
"SELECT command, timestamp FROM cmd_history ORDER BY id ASC"
|
|
58
|
+
).fetchall()
|
|
59
|
+
]
|
|
60
|
+
),
|
|
61
|
+
)
|
|
62
|
+
data.append_history("cmd1", "2026-01-01T00:00:00Z", filename=test_db)
|
|
63
|
+
data.append_history("cmd2", "2026-01-01T00:01:00Z", filename=test_db)
|
|
64
|
+
cmd = utils.History()
|
|
65
|
+
code, msg = cmd.execute(["1"])
|
|
66
|
+
assert code == 0
|
|
67
|
+
assert "cmd2" in msg
|
|
68
|
+
assert "cmd1" not in msg
|
|
69
|
+
code, msg = cmd.execute(["all"])
|
|
70
|
+
assert code == 0
|
|
71
|
+
assert "cmd1" in msg
|
|
72
|
+
assert "cmd2" in msg
|
|
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
|