Skip to content

iOS SSL Pinning 测试 tests/commands/ios/test_pinning.py ​

这个测试文件验证 objection 的 iOS SSL pinning 绕过命令 ios_disable 与辅助函数 _should_be_quiet,覆盖 RPC 透传与 --quiet flag 解析。

📋 模块概览 ​

项目值
文件路径tests/commands/ios/test_pinning.py
被测对象objection.commands.ios.pinning(ios_disable、_should_be_quiet)
用例数3
框架unittest(mock.patch)

🎯 测试意图 ​

  • 验证 ios_disable([]) 触发 ios_pinning_disable RPC。
  • 验证 _should_be_quiet 在含 --quiet 时返回 True,不含时返回 False。

🧪 用例清单 ​

用例行号验证点
test_disabletests/commands/ios/test_pinning.py:9触发 pinning 禁用 RPC
test_should_be_quiet_returns_truetests/commands/ios/test_pinning.py:14--quiet 返回 True
test_should_be_quiet_returns_falsetests/commands/ios/test_pinning.py:18无 flag 返回 False

⚙️ 测试手法 ​

test_disable 用 @mock.patch(...get_api)(:8)注入 mock,调用后断言 RPC .called。两个 _should_be_quiet 用例直接传入参数列表并断言布尔返回,无 mock、无 capture。

🔍 源码索引 ​

用例位置
test_disabletests/commands/ios/test_pinning.py:9
test_should_be_quiet_returns_truetests/commands/ios/test_pinning.py:14
test_should_be_quiet_returns_falsetests/commands/ios/test_pinning.py:18

🔗 相关文档 ​

  • 对应被测模块文档:/reference/commands/ios/pinning(如存在)

基于 GPL-3.0-or-later 许可发布