[Buildroot] [git commit] support/testing: fix python_flask_expect_python
From: Arnout Vandecappelle (Essensium/Mind) <hidden>
Date: 2021-10-12 20:55:19
Subsystem:
the rest · Maintainer:
Linus Torvalds
commit: https://git.buildroot.net/buildroot/commit/?id=128af17dce9cc377c5d58fd9f3adb157e6bcb958 branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master Commit e6ee07f41a2b (package/python-flask-expects-json: new package) added a non-functional test case that, as noticed by Edgar, fails with: AssertionError: '%{http_code}' != '200' That's because the % sign is self-escaped, ��-la C, in the first part of the command, probably to avoid its being %-formatted. But only the second part of the command is %-formatted, so we do not need to self-escape % in the first part. Additionally, since eb3ee3078a76 (support/testing/infra/emulator.py: prevent the commands from wrapping), we no longer need to play tricks with commands that are too long to fit on the first line of the shell prompt. Signed-off-by: Yann E. MORIN <redacted> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Cc: Edgar Bonet <redacted> Reviewed-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <redacted> --- support/testing/tests/package/test_python_flask_expects_json.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/support/testing/tests/package/test_python_flask_expects_json.py b/support/testing/tests/package/test_python_flask_expects_json.py
index b7326f5d9e..5576cba2b4 100644
--- a/support/testing/tests/package/test_python_flask_expects_json.py
+++ b/support/testing/tests/package/test_python_flask_expects_json.py@@ -17,11 +17,11 @@ class TestPythonPy3FlaskExpectsJson(TestPythonPackageBase): timeout = 60 def try_json(self, payload, expects): - cmd = """curl -s -o /dev/null -w "%%{http_code}\\n" -X POST """ + cmd = """curl -s -o /dev/null -w "%{http_code}\\n" -X POST """ cmd += """-H "Content-Type: application/json" -d '%s' http://127.0.0.1:5000""" % payload output, exit_code = self.emulator.run(cmd, timeout=self.timeout) self.assertEqual(exit_code, 0) - self.assertEqual(output[-1], str(expects)) + self.assertEqual(output[0], str(expects)) def test_run(self): self.login()