From 3a7bbfbb88754c15142a25fc23e5659c31c9db49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=AC=E6=98=8E?= <83812544+Ed1s0nZ@users.noreply.github.com> Date: Sun, 8 Mar 2026 04:02:05 +0800 Subject: [PATCH] Delete internal/handler/wecom_test.go --- internal/handler/wecom_test.go | 44 ---------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 internal/handler/wecom_test.go diff --git a/internal/handler/wecom_test.go b/internal/handler/wecom_test.go deleted file mode 100644 index 46f29b79..00000000 --- a/internal/handler/wecom_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package handler - -import ( - "testing" -) - -// smoke test for the internal wecom encryption/decryption helpers. the -// functions are intentionally unexported because they're implementation -// detail for the robot handler, but we can still write a simple unit test -// in the same package to verify that round trips work with real values from -// our configuration. - -func TestWecomEncryptDecrypt(t *testing.T) { - // these values are pulled from the example config that is used in the - // workspace; the encode key must be the 43-character string (base64 - // encoded AES key) and the corpID should match the ToUserName that we - // receive in callbacks. - encodingKey := "TupAQh8HeOFYLrRhH8xc3wvJeds6nu1Xr0hn1Lfy1Gh" - corpID := "wwf37149f596dd5638" - - // build a sample XML payload exactly how sendWecomReply constructs it. - msg := `` + - `` + - `` + - `12345` + - `` + - `` + - `` + - `` - - enc, err := wecomEncrypt(encodingKey, msg, corpID) - if err != nil { - t.Fatalf("encrypt error: %v", err) - } - - dec, err := wecomDecrypt(encodingKey, enc) - if err != nil { - t.Fatalf("decrypt error: %v", err) - } - - if string(dec) != msg { - t.Fatalf("round trip mismatch; got %q", string(dec)) - } -}