From 6e14ef3d438d27418574b235b017aec76203c865 Mon Sep 17 00:00:00 2001 From: Sizhe Zhao Date: Wed, 13 Aug 2025 14:55:23 +0800 Subject: [PATCH] nixosTests.mitmproxy: test mitmproxy2swagger --- nixos/tests/mitmproxy.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nixos/tests/mitmproxy.nix b/nixos/tests/mitmproxy.nix index aa71d64cea18..fe571bc430d0 100644 --- a/nixos/tests/mitmproxy.nix +++ b/nixos/tests/mitmproxy.nix @@ -71,6 +71,7 @@ in [ counter pkgs.mitmproxy + pkgs.mitmproxy2swagger ]; }; @@ -130,5 +131,17 @@ in machine.succeed("mitmdump -C /root/replay") t.assertEqual("2", curl("http://localhost:8000/counter")) + + # create a OpenAPI 3.0 spec from captured flow + # https://github.com/alufers/mitmproxy2swagger + + # create a initial spec + machine.succeed("mitmproxy2swagger -i /root/replay -f flow -o /root/spec -p http://localhost:8000") + # don't ignore any endpoint + machine.succeed("sed -i -e 's/- ignore:/- /' /root/spec") + # generate the actual spec + machine.succeed("mitmproxy2swagger -i /root/replay -f flow -o /root/spec -p http://localhost:8000") + # check for endpoint /counter + machine.succeed("grep '/counter:' /root/spec") ''; }