From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Morgan Smith Newsgroups: gmane.emacs.bugs Subject: bug#72574: [PATCH 3/3] Add tests Date: Sun, 11 Aug 2024 08:18:41 -0400 Message-ID: References: <20240811121841.5584-1-Morgan.J.Smith@outlook.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="649"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Morgan Smith , Michael Albinus To: 72574@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 11 14:20:57 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sd7ZA-000AXr-JG for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 11 Aug 2024 14:20:57 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sd7Yn-0006hR-Ke; Sun, 11 Aug 2024 08:20:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sd7Yl-0006h8-Vm for bug-gnu-emacs@gnu.org; Sun, 11 Aug 2024 08:20:32 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sd7Yl-0004qv-Mc for bug-gnu-emacs@gnu.org; Sun, 11 Aug 2024 08:20:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=HxgQBghrK6E/UAJODKlz33DXPAHvFtN42yiCFy4o/q0=; b=HDMhlgNllNsqg0BxDenMrnxrfQNNZ/IwA6Z9A4MCOSSDFbOVh28Yc9D5MOLKl55WyEwfsiRz6s0cG7fG0Zqa8l52dC4itwD/TLvVRjdDZFFnP2lgczLlnqAOSmxEzwyj/X7nnOcJZAH+yH2GY7QcsIZLC+JIIYO16ivTPwbXOhl2OqOK8dYVODwwGmpQrh/4ZjuaG13wpbpBiSLziejvyr+fF+ldfCk8LyAS+h1PoOfgvBV11jZv62MJY/6TaYS/9koGlVxkyg333wi3z6EoTpoQ4OlApztZMoHQvU/sBwD5VgDcgD+m0Ac39680EIBAAoUAfpQz/g9gOW5NGCpgww==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sd7ZG-0002Z8-7h for bug-gnu-emacs@gnu.org; Sun, 11 Aug 2024 08:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Morgan Smith Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 11 Aug 2024 12:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72574 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 72574-submit@debbugs.gnu.org id=B72574.17233788049754 (code B ref 72574); Sun, 11 Aug 2024 12:21:02 +0000 Original-Received: (at 72574) by debbugs.gnu.org; 11 Aug 2024 12:20:04 +0000 Original-Received: from localhost ([127.0.0.1]:40912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sd7YJ-0002XA-Mt for submit@debbugs.gnu.org; Sun, 11 Aug 2024 08:20:04 -0400 Original-Received: from mail-sn1nam02olkn2084.outbound.protection.outlook.com ([40.92.44.84]:58934 helo=NAM02-SN1-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sd7YF-0002W6-Qt for 72574@debbugs.gnu.org; Sun, 11 Aug 2024 08:20:00 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zFnxSsGQm6yIPQr1bXgLK1Q2Ib57Gwd3jzk3H9I7nrHeD3M1Rjgm2s/8YBkcPV21yZD5/SNe+79UuSR6ZesA58aZYekLuGUXUbFcb7jFZC/7DZiDBd5r2gYFwid9IE8gevZaU9pBNDZeJTu4vuIFreJS89Gazxb4IkK1UcFpit5C4PWQSTCluZxMPb/13DNjQqD4SCVvzO7y8XniMhU7MCJnzl8hgBAzig6XOwocmFhFC76WZa2sZC3p3uqKI2i6BvInTLZXSTMsAW9W5n11IbDX90Z6GLIQm2lXI+cUBRD2xQccsbmNmkY8JqGDHtxQ+xBYRzIPMWAy7bMIkvNb4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HxgQBghrK6E/UAJODKlz33DXPAHvFtN42yiCFy4o/q0=; b=zHEecxE1JU4VPR9aJ/YUnbZT+eTpc6XHBfZflKVLS+RpPzidnaeAqGE99Y/cE/m040z60TnjWE6OoNHZnbC7Xa++Wt8Uq0j8obAPpXbrZeHX9xng0J7NenB7xHKIy+MYPaOoLOflTkFF1dcheLBtTeznmhE2zEnFMUzrpVfZLWns4kfLsfS/zdLsla0D52hyFon08yXmGIvbnJmyeTU92RhdI5rZt5EzSW7ROct0fZkbfE/kWQq8Rwrxs7834gn9yu611+EnTb50CDMuCZhUwEO3mzb7f1tHE8DyPkHXqYhxUMsid5H5A5DvIbby/KJ1v+QqcU4L82WpNL3Z/KYgiQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HxgQBghrK6E/UAJODKlz33DXPAHvFtN42yiCFy4o/q0=; b=ZLZt8t4Yj5/iNTsP3XtH0iz6GIOSPNrxWlgdTaC02TnxBmLZ3Jpc6iueqQ6bW5lVRBRtL9rfDZ55hgd+2h0XP/maRQFnn5L2o7wSyegLlbE6TFXZaKxCqs3zrX5S4Av//CgiNcjKioz6L3GqtU9nVzxrsZicpri2MPt1ulxP2iRtjtWFC5t7aEtP3OkAF8B2eVDRwADF2s+Zb10idYAfjXPddyC3fz//NY3Xc8EIs/J3nQ7aphr9CHxfJOv5hORqgngDUrJPG5HkzNgJ0HHTZfo5VEuavlbs4uLS/w0VzY0gKZLdHsIkeNbAkm9TpmifXNtaiarE6hoV4m3DFdJKuQ== Original-Received: from CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:610:1c4::17) by MW4PR84MB1489.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:303:1a4::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.19; Sun, 11 Aug 2024 12:19:14 +0000 Original-Received: from CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM ([fe80::5c77:7a58:48ed:9aef]) by CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM ([fe80::5c77:7a58:48ed:9aef%7]) with mapi id 15.20.7849.018; Sun, 11 Aug 2024 12:19:13 +0000 X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240811121841.5584-1-Morgan.J.Smith@outlook.com> X-TMN: [BcLoMQD2anLEc8XbxHTP9HDL9e8v2kS5] X-ClientProxiedBy: YQBP288CA0018.CANP288.PROD.OUTLOOK.COM (2603:10b6:c01:6a::21) To CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:610:1c4::17) X-Microsoft-Original-Message-ID: <20240811121841.5584-3-Morgan.J.Smith@outlook.com> X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR84MB3424:EE_|MW4PR84MB1489:EE_ X-MS-Office365-Filtering-Correlation-Id: 905ef3d3-9b85-46ff-e4de-08dcb9ffcfa0 X-Microsoft-Antispam: BCL:0; ARA:14566002|8060799006|461199028|5072599009|15080799003|19110799003|440099028|3412199025|1710799026; X-Microsoft-Antispam-Message-Info: 02aGDC6hu7FPDcJaPJ4VEZDIJo2hp9m6+Yl99cDaY+ZjxuHeKCy7bJrYKTN9oJo028LkjIVWMLCiIkW6sMbt3+OfS9vJoS5gEVG8OjzJ+O40y8QxR0vuGQt31RNmkMuuGI6WZR7RdIOa64619DDvwv+AE5SVKfKXE176QzN9cTAMQR3rNEgIELzlhR2Ic2KMzm5We2x5P8GbA/WPrulSYroPtJhkRPAqOxuBb2IgGD6Kji8LN+Kbqfh51LqJglBLa23nRjVNAGuGSaf8WA1ciBQzVFQ1H6OXylvNYm2o2/3ZIZf9Dcp3QSGzb2xZcsUm9P+eJdxoo/bcQNP+Ma8M79ehWIvlMx9yaGQI/3MBFIXx+udzQRbpu7usZA/5jGiVQZcJf6hsPlsGXDPYyj7m/BZH/sKKP9GbZiGL1tMbgSAJqtqJwhGv/OuJYi/xd2WtgsHS/tsaXWx/Cif97klf5dathwiWGz4YjMMRVovp8AwvjMA6q9LRDxMPL8cT9QY3BGUPa2eOTMeSwbvIzppZh1FwnKINtHVaklRPyBP9dH3IvPLjdmpISzv3Fxx7h/C5YZbb9MIyB5UMkzkUXHGuird2EpMI0HrHk4LULdDT7QHpQQ5g+pe/321lRnWXvNFMiGhVAWgbMoO09vZX/53+6JpAI514D+EZy1B1Jy96VDerVzCuCnHIfTtqbqh71I1wKxuo6kgpMbarTT5zuTvOERGNk8+wEwDpur/KxqAZ41U= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: y5bW5Wt1DRKyj1UEuEvF+EoYjHYEzKucd4xgjTnM7TK7NC06VG2AdIQ84ElVxydEnFXakWcFl85rrVQfr2IyopNoG/UPvAzlSjQ3s1emPOK7aAFReUSJhz+sX0b4KjF62DrEeEfppmMlzyTD7/r3DnZhyJ4ZMkBG8eTmp4GVWne5UcZFuGLQ/qHnlt9glMLQzM7dyd/vpJWtNP0TQbkLtHZpRCOt5d9lfJpBPBXtOCR4iXjVfz3TpohDtET8fXRWbSHceLphyXrpUkhOo5yR8WO9W2Up5wa9FDrDg27VaQj3Q+lwHqElmn1O8vYzJSx161vWu3MO0CRG+WH6Q+4EcPq7VVRWu4MHk5l493bL+3Cc/qo68334//KQRrVyYe79QatLOsTcemmvonuNulDLs6n4dJ28K2pF+FKi5EqwLy3QsLGbYJfdeeZtsslafWvy8JfluQ9JlHC5Bgl9SGNo2NndPXFLUtD3mmjf+vi/bTYtOPlkd5wXmxlDDj2sb1zwFdfu8i9dcHugt7JUSMrRalrC2T2//GpXkAxpH4E9/vPxjuWnOkZKEM0UmAecsat5T4MhCKuCj0qi2weKecQtFiYuujwvZZidSlaM64YG1WlHXltWA5GBvCFbkP7ehWLoGU1ZGMeUFDr0R50G+K1XhQ5d/EDfW6vnIigtxQnRfaiW6NDPdOBCKNvlC0SBULp5Bu1p/QzhXmoUgA7C3G4YuDt4kCuSxiDnx1g/gSmS6eTckZDi7pzPy2DPJv iQULxE2jK0KFl62CF6MaRAHFF2AMLQMAYj3ytoo1AN6ngbbH0Cd9pg6WZYS2kj8HvOKjNS9kN0d53W0AwthhgtwHHCKtvlwdNV X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 905ef3d3-9b85-46ff-e4de-08dcb9ffcfa0 X-MS-Exchange-CrossTenant-AuthSource: CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2024 12:19:13.2849 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR84MB1489 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:290018 Archived-At: * Makefile: New file. * test/test-debbugs.el: New file. --- Makefile | 4 ++ test/test-debbugs.el | 101 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 Makefile create mode 100644 test/test-debbugs.el diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..3a4b06a76e --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +.PHONY: check + +check: + emacs -Q --batch -L . -l test/* -f ert-run-tests-batch-and-exit diff --git a/test/test-debbugs.el b/test/test-debbugs.el new file mode 100644 index 0000000000..8eca3fe3a8 --- /dev/null +++ b/test/test-debbugs.el @@ -0,0 +1,101 @@ +;;; test-debbugs.el --- tests for debbugs.el -*- lexical-binding: t; -*- + +;;; Commentary: + +;; Please ensure tests don't actually make network calls. + +;;; Code: + +(require 'debbugs) + +;;; Helper Data: + +;; Generated using this: +;; (soap-invoke debbugs-wsdl debbugs-port "get_status" [64064]) +(defvar test-bug-status-soap-return + '(((item (key . 64064) + (value (package . "emacs") (found_date) (last_modified . 1689593050) + (affects) (date . 1686745022) (fixed_versions) + (originator . "Morgan Smith ") + (blocks) (archived . 1) (found) (unarchived) (tags . "patch") + (severity . "normal") (location . "archive") (owner) (fixed) + (blockedby) (pending . "done") (keywords . "patch") (id . 64064) + (found_versions) (mergedwith) (summary) (forwarded) + (log_modified . 1689593050) + (done . "Michael Albinus ") + (source . "unknown") + (msgid + . "") + (bug_num . 64064) (subject . "[PATCH 0/4] debbugs improvements") + (fixed_date)))))) + +;; Generated using this: +;; (debbugs-get-status 64064) +(defvar test-bug-status + '(((cache_time . 5000) (source . "unknown") (unarchived) + (keywords "patch") (blocks) (pending . "done") (severity . "normal") (found) + (done . "Michael Albinus ") (location . "archive") + (log_modified . 1689593050) (subject . "[PATCH 0/4] debbugs improvements") + (last_modified . 1689593050) + (originator . "Morgan Smith ") (archived . t) + (blockedby) (affects) (mergedwith) (summary) (date . 1686745022) + (fixed_versions) (id . 64064) (fixed) (found_date) (forwarded) (tags "patch") + (msgid + . "") + (owner) (found_versions) (fixed_date) (bug_num . 64064) (package "emacs")))) + +;;; Helper Functions: + +(defvar test-soap-operation-name nil) +(defvar test-soap-parameters nil) +(defun soap-invoke-internal (callback _cbargs _wsdl _service operation-name &rest parameters) + "Over-ride for testing" + (setq test-soap-operation-name operation-name) + (setq test-soap-parameters parameters) + (let ((return + (cond ((string-equal operation-name "get_status") test-bug-status-soap-return) + ((string-equal operation-name "get_usertag") '(((hi)))) + (t '((0)))))) + (if callback + (progn + (funcall callback return) + nil) + return))) + +;;; Tests: + +(ert-deftest test-debbugs-get-bugs () + (let (test-soap-operation-name test-soap-parameters) + (debbugs-get-bugs + :tag "patch" + :severity "critical" + :status "open" + :status "forwarded") + (should (string-equal test-soap-operation-name "get_bugs")) + (should (equal test-soap-parameters '(["tag" "patch" "severity" "critical" + "status" "open" "status" "forwarded"]))))) + +(ert-deftest test-debbugs-newest-bugs () + (let (test-soap-operation-name test-soap-parameters) + (debbugs-newest-bugs 4) + (should (string-equal test-soap-operation-name "newest_bugs")) + (should (equal test-soap-parameters '(4))))) + +(ert-deftest test-debbugs-get-status () + (let ((original-float-time (symbol-function 'float-time)) + test-soap-operation-name test-soap-parameters) + (fset 'float-time (lambda (&optional _specified-time) 5000)) + (should (= (float-time) 5000)) + (should (equal (sort (car (debbugs-get-status 64064))) (sort (car test-bug-status)))) + (should (string-equal test-soap-operation-name "get_status")) + (should (equal test-soap-parameters '([64064]))) + (fset 'float-time original-float-time))) + +(ert-deftest test-debbugs-get-usertag () + (let (test-soap-operation-name test-soap-parameters) + (should (equal (debbugs-get-usertag :user "emacs") '("hi"))) + (should (string-equal test-soap-operation-name "get_usertag")) + (should (equal test-soap-parameters '("emacs"))))) + +(provide 'test-debbugs) +;;; test-debbugs.el ends here -- 2.45.2