From e5ed34c7655e0826087cd7c1af056883ba410396 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 27 Aug 2022 09:13:38 +0200 Subject: woodpecker CI add --- .travis.yml | 22 ---------------------- .woodpecker.yml | 5 +++++ 2 files changed, 5 insertions(+), 22 deletions(-) delete mode 100644 .travis.yml create mode 100644 .woodpecker.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5f5796c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: emacs-lisp -sudo: false -before_install: - - curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > x.sh && source ./x.sh - - evm install $EVM_EMACS --use --skip - - cask install -env: - - EVM_EMACS=emacs-24.5-travis - - EVM_EMACS=emacs-25.1-travis -script: - - emacs --version - - cask build - - cask clean-elc - - cask exec ert-runner -l test/ert-helper.el test/*-tests.el - - cask emacs --batch -Q -l package-lint.el -f package-lint-batch-and-exit lisp/*.el -notifications: - webhooks: - urls: - - "https://scalar.vector.im/api/neb/services/hooks/dHJhdmlzLWNpLyU0MGpvaG5zb24lM0FtYXRyaXgub3JnLyUyMVpSbGVnVEFCTHBTQmJ2c01tTiUzQW1hdHJpeC5vcmc" - on_success: always # always|never|change - on_failure: always - on_start: never diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..4de0d93 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,5 @@ +pipeline: + build: + image: silex/emacs:cask + commands: cask emacs -batch -l test/ert-helper.el -l test/*-tests.el -f ert-run-tests-batch-and-exit + -- cgit v1.2.3 From f3c7687c1a33593eecadaac8c8c9a4e3baf181e9 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 27 Aug 2022 09:44:14 +0200 Subject: update dependencies, request version consistency --- lisp/mastodon-profile.el | 2 +- lisp/mastodon.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 8ae5ace..c589f53 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -4,7 +4,7 @@ ;; Author: Johnson Denen ;; Maintainer: Marty Hiatt ;; Version: 0.10.0 -;; Package-Requires: ((emacs "27.1") (seq "1.0")) +;; Package-Requires: ((emacs "27.1") ;; Homepage: https://codeberg.org/martianh/mastodon.el ;; This file is not part of GNU Emacs. diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 632f5c5..4373ef2 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -5,7 +5,7 @@ ;; Author: Johnson Denen ;; Maintainer: Marty Hiatt ;; Version: 0.10.0 -;; Package-Requires: ((emacs "27.1") (request "0.3.2") (seq "1.0")) +;; Package-Requires: ((emacs "27.1") (request "0.3.0")) ;; Homepage: https://codeberg.org/martianh/mastodon.el ;; This file is not part of GNU Emacs. -- cgit v1.2.3 From 1fbfbf318a79a4e0826a33f0c46e195aee0ded6f Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sun, 31 Jul 2022 22:54:30 +0200 Subject: bump version in boilerplate --- lisp/mastodon-async.el | 2 +- lisp/mastodon-auth.el | 2 +- lisp/mastodon-client.el | 2 +- lisp/mastodon-discover.el | 2 +- lisp/mastodon-http.el | 2 +- lisp/mastodon-inspect.el | 2 +- lisp/mastodon-media.el | 2 +- lisp/mastodon-notifications.el | 2 +- lisp/mastodon-profile.el | 4 ++-- lisp/mastodon-search.el | 2 +- lisp/mastodon-tl.el | 2 +- lisp/mastodon-toot.el | 2 +- lisp/mastodon.el | 6 +++--- 13 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lisp/mastodon-async.el b/lisp/mastodon-async.el index 86547a1..8a08416 100644 --- a/lisp/mastodon-async.el +++ b/lisp/mastodon-async.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2017 Alex J. Griffith ;; Author: Alex J. Griffith ;; Maintainer: Marty Hiatt -;; Version: 0.10.0 +;; Version: 1.0.0 ;; Package-Requires: ((emacs "27.1")) ;; Homepage: https://codeberg.org/martianh/mastodon.el diff --git a/lisp/mastodon-auth.el b/lisp/mastodon-auth.el index 2f333b7..02799bf 100644 --- a/lisp/mastodon-auth.el +++ b/lisp/mastodon-auth.el @@ -4,7 +4,7 @@ ;; Copyright (C) 2021 Abhiseck Paira ;; Author: Johnson Denen ;; Maintainer: Marty Hiatt -;; Version: 0.10.0 +;; Version: 1.0.0 ;; Package-Requires: ((emacs "27.1")) ;; Homepage: https://codeberg.org/martianh/mastodon.el diff --git a/lisp/mastodon-client.el b/lisp/mastodon-client.el index 4fc8db7..f1dcd4f 100644 --- a/lisp/mastodon-client.el +++ b/lisp/mastodon-client.el @@ -4,7 +4,7 @@ ;; Copyright (C) 2021 Abhiseck Paira ;; Author: Johnson Denen ;; Maintainer: Marty Hiatt -;; Version: 0.10.0 +;; Version: 1.0.0 ;; Package-Requires: ((emacs "27.1")) ;; Homepage: https://codeberg.org/martianh/mastodon.el diff --git a/lisp/mastodon-discover.el b/lisp/mastodon-discover.el index a63d500..20ed092 100644 --- a/lisp/mastodon-discover.el +++ b/lisp/mastodon-discover.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2019 Johnson Denen ;; Author: Johnson Denen ;; Maintainer: Marty Hiatt -;; Version: 0.10.0 +;; Version: 1.0.0 ;; Package-Requires: ((emacs "27.1")) ;; Homepage: https://codeberg.org/martianh/mastodon.el diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el index ec3b5e6..49b2375 100644 --- a/lisp/mastodon-http.el +++ b/lisp/mastodon-http.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2017-2019 Johnson Denen ;; Author: Johnson Denen ;; Maintainer: Marty Hiatt -;; Version: 0.10.0 +;; Version: 1.0.0 ;; Package-Requires: ((emacs "27.1") (request "0.3.0")) ;; Homepage: https://codeberg.org/martianh/mastodon.el diff --git a/lisp/mastodon-inspect.el b/lisp/mastodon-inspect.el index 15ee7ce..cbf6a8e 100644 --- a/lisp/mastodon-inspect.el +++ b/lisp/mastodon-inspect.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2017-2019 Johnson Denen ;; Author: Johnson Denen ;; Maintainer: Marty Hiatt -;; Version: 0.10.0 +;; Version: 1.0.0 ;; Package-Requires: ((emacs "27.1")) ;; Homepage: https://codeberg.org/martianh/mastodon.el diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index e5a1111..ace15b2 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2017-2019 Johnson Denen ;; Author: Johnson Denen ;; Maintainer: Marty Hiatt -;; Version: 0.10.0 +;; Version: 1.0.0 ;; Package-Requires: ((emacs "27.1")) ;; Homepage: https://codeberg.org/martianh/mastodon.el diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index 89532c7..0d11fb4 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2017-2019 Johnson Denen ;; Author: Johnson Denen ;; Maintainer: Marty Hiatt -;; Version: 0.10.0 +;; Version: 1.0.0 ;; Package-Requires: ((emacs "27.1")) ;; Homepage: https://codeberg.org/martianh/mastodon.el diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index c589f53..4b541fd 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -3,8 +3,8 @@ ;; Copyright (C) 2017-2019 Johnson Denen ;; Author: Johnson Denen ;; Maintainer: Marty Hiatt -;; Version: 0.10.0 -;; Package-Requires: ((emacs "27.1") +;; Version: 1.0.0 +;; Package-Requires: ((emacs "27.1")) ;; Homepage: https://codeberg.org/martianh/mastodon.el ;; This file is not part of GNU Emacs. diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el index b9dcb18..8d450e3 100644 --- a/lisp/mastodon-search.el +++ b/lisp/mastodon-search.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2017-2019 Marty Hiatt ;; Author: Marty Hiatt ;; Maintainer: Marty Hiatt -;; Version: 0.10.0 +;; Version: 1.0.0 ;; Package-Requires: ((emacs "27.1")) ;; Homepage: https://codeberg.org/martianh/mastodon.el diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 4e2a8ba..45e7282 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -4,7 +4,7 @@ ;; Author: Johnson Denen ;; Marty Hiatt ;; Maintainer: Marty Hiatt -;; Version: 0.10.0 +;; Version: 1.0.0 ;; Package-Requires: ((emacs "27.1")) ;; Homepage: https://codeberg.org/martianh/mastodon.el diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 9abbb62..be3aaad 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -4,7 +4,7 @@ ;; Author: Johnson Denen ;; Marty Hiatt ;; Maintainer: Marty Hiatt -;; Version: 0.10.0 +;; Version: 1.0.0 ;; Package-Requires: ((emacs "27.1")) ;; Homepage: https://codeberg.org/martianh/mastodon.el diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 4373ef2..9400014 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -4,7 +4,7 @@ ;; Copyright (C) 2021 Abhiseck Paira ;; Author: Johnson Denen ;; Maintainer: Marty Hiatt -;; Version: 0.10.0 +;; Version: 1.0.0 ;; Package-Requires: ((emacs "27.1") (request "0.3.0")) ;; Homepage: https://codeberg.org/martianh/mastodon.el @@ -28,8 +28,8 @@ ;;; Commentary: ;; mastodon.el is an Emacs client for Mastodon , -;; the federated microblogging social network. It is very much a work-in-progress, but -;; it is a labor of love. +;; the federated microblogging social network. It also works with Pleroma instances. +;; see the readme file at https://codeberg.org/martianh/mastodon.el for set up and usage details. ;;; Code: (require 'cl-lib) ; for `cl-some' call in mastodon -- cgit v1.2.3 From 9f1c9c8415e74b92fa2ed06cc088ebaa50e1ac73 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 27 Aug 2022 09:52:41 +0200 Subject: Cask request dep version --- Cask | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cask b/Cask index 60a064c..3f7825f 100644 --- a/Cask +++ b/Cask @@ -4,7 +4,7 @@ (package-file "lisp/mastodon.el") (files "lisp/*.el") -(depends-on "request") +(depends-on "request" "0.3.0") (depends-on "seq") (development -- cgit v1.2.3 From 172f663ed32f2f0b175c98788cf0e3097c17161a Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 27 Aug 2022 09:56:52 +0200 Subject: woodpecker cask install deps --- .woodpecker.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 4de0d93..26dc9d7 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,5 +1,7 @@ pipeline: build: image: silex/emacs:cask - commands: cask emacs -batch -l test/ert-helper.el -l test/*-tests.el -f ert-run-tests-batch-and-exit + commands: + - cask install + - cask emacs -batch -l test/ert-helper.el -l test/*-tests.el -f ert-run-tests-batch-and-exit -- cgit v1.2.3 From 103b2d5d9bbc969bb2eb48f3238ef764858248b8 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 27 Aug 2022 10:30:31 +0200 Subject: masto notifs tests filename correct --- test/mastodon-notifications-test.el | 217 ----------------------------------- test/mastodon-notifications-tests.el | 217 +++++++++++++++++++++++++++++++++++ 2 files changed, 217 insertions(+), 217 deletions(-) delete mode 100644 test/mastodon-notifications-test.el create mode 100644 test/mastodon-notifications-tests.el diff --git a/test/mastodon-notifications-test.el b/test/mastodon-notifications-test.el deleted file mode 100644 index 4804e10..0000000 --- a/test/mastodon-notifications-test.el +++ /dev/null @@ -1,217 +0,0 @@ -;;; mastodon-notifications-test.el --- Tests for mastodon-notifications.el -*- lexical-binding: nil -*- - -(require 'cl-lib) -(require 'cl-macs) -(require 'el-mock) - -(defconst mastodon-notifications--test-base-mentioned - '((id . "1234") - (type . "mention") - (created_at . "2018-03-06T04:27:21.288Z" ) - (account (id . 42) - (username . "acct42") - (acct . "acct42@example.space") - (display_name . "Account 42") - (locked . :json-false) - (created_at . "2017-04-01T00:00:00.000Z") - (followers_count . 99) - (following_count . 13) - (statuses_count . 101) - (note . "E")) - (status (id . 61208) - (created_at . "2017-04-24T19:01:02.000Z") - (in_reply_to_id) - (in_reply_to_account_id) - (sensitive . :json-false) - (spoiler_text . "") - (visibility . "public") - (account (id . 42) - (username . "acct42") - (acct . "acct42@example.space") - (display_name . "Account 42") - (locked . :json-false) - (created_at . "2017-04-01T00:00:00.000Z") - (followers_count . 99) - (following_count . 13) - (statuses_count . 101) - (note . "E")) - (media_attachments . []) - (mentions . []) - (tags . []) - (uri . "tag:example.space,2017-04-24:objectId=654321:objectType=Status") - (url . "https://example.space/users/acct42/updates/123456789") - (content . "

Just some text

") - (reblogs_count . 0) - (favourites_count . 0) - (reblog)))) - -(defconst mastodon-notifications--test-base-favourite - '((id . "1234") - (type . "favourite") - (created_at . "2018-03-06T04:27:21.288Z" ) - (account (id . 42) - (username . "acct42") - (acct . "acct42@example.space") - (display_name . "Account 42") - (locked . :json-false) - (created_at . "2017-04-01T00:00:00.000Z") - (followers_count . 99) - (following_count . 13) - (statuses_count . 101) - (note . "E")) - (status (id . 61208) - (created_at . "2017-04-24T19:01:02.000Z") - (in_reply_to_id) - (in_reply_to_account_id) - (sensitive . :json-false) - (spoiler_text . "") - (visibility . "public") - (account (id . 42) - (username . "acct42") - (acct . "acct42@example.space") - (display_name . "Account 42") - (locked . :json-false) - (created_at . "2017-04-01T00:00:00.000Z") - (followers_count . 99) - (following_count . 13) - (statuses_count . 101) - (note . "E")) - (media_attachments . []) - (mentions . []) - (tags . []) - (uri . "tag:example.space,2017-04-24:objectId=654321:objectType=Status") - (url . "https://example.space/users/acct42/updates/123456789") - (content . "

Just some text

") - (reblogs_count . 0) - (favourites_count . 0) - (reblog)))) - -(defconst mastodon-notifications--test-base-boosted - '((id . "1234") - (type . "reblog") - (created_at . "2018-03-06T04:27:21.288Z" ) - (account (id . 42) - (username . "acct42") - (acct . "acct42@example.space") - (display_name . "Account 42") - (locked . :json-false) - (created_at . "2017-04-01T00:00:00.000Z") - (followers_count . 99) - (following_count . 13) - (statuses_count . 101) - (note . "E")) - (status (id . 61208) - (created_at . "2017-04-24T19:01:02.000Z") - (in_reply_to_id) - (in_reply_to_account_id) - (sensitive . :json-false) - (spoiler_text . "") - (visibility . "public") - (account (id . 42) - (username . "acct42") - (acct . "acct42@example.space") - (display_name . "Account 42") - (locked . :json-false) - (created_at . "2017-04-01T00:00:00.000Z") - (followers_count . 99) - (following_count . 13) - (statuses_count . 101) - (note . "E")) - (media_attachments . []) - (mentions . []) - (tags . []) - (uri . "tag:example.space,2017-04-24:objectId=654321:objectType=Status") - (url . "https://example.space/users/acct42/updates/123456789") - (content . "

Just some text

") - (reblogs_count . 0) - (favourites_count . 0) - (reblog)))) - -(defconst mastodon-notifications--test-base-followed - '((id . "1234") - (type . "follow") - (created_at . "2018-03-06T04:27:21.288Z" ) - (account (id . 42) - (username . "acct42") - (acct . "acct42@example.space") - (display_name . "Account 42") - (locked . :json-false) - (created_at . "2017-04-01T00:00:00.000Z") - (followers_count . 99) - (following_count . 13) - (statuses_count . 101) - (note . "E")) - (status (id . 61208) - (created_at . "2017-04-24T19:01:02.000Z") - (in_reply_to_id) - (in_reply_to_account_id) - (sensitive . :json-false) - (spoiler_text . "") - (visibility . "public") - (account (id . 42) - (username . "acct42") - (acct . "acct42@example.space") - (display_name . "Account 42") - (locked . :json-false) - (created_at . "2017-04-01T00:00:00.000Z") - (followers_count . 99) - (following_count . 13) - (statuses_count . 101) - (note . "E")) - (media_attachments . []) - (mentions . []) - (tags . []) - (uri . "tag:example.space,2017-04-24:objectId=654321:objectType=Status") - (url . "https://example.space/users/acct42/updates/123456789") - (content . "

Just some text

") - (reblogs_count . 0) - (favourites_count . 0) - (reblog)))) - -(defconst mastodon-notifications--test-base-favourite - '((id . "1234") - (type . "mention") - (created_at . "2018-03-06T04:27:21.288Z" ) - (account (id . 42) - (username . "acct42") - (acct . "acct42@example.space") - (display_name . "Account 42") - (locked . :json-false) - (created_at . "2017-04-01T00:00:00.000Z") - (followers_count . 99) - (following_count . 13) - (statuses_count . 101) - (note . "E")))) - -(ert-deftest mastodon-notifications--notification-get () - "Ensure get request format for notifictions is accurate." - (let ((mastodon-instance-url "https://instance.url")) - (with-mock - (mock (mastodon-http--get-json "https://instance.url/api/v1/notifications" )) - (mastodon-notifications--get)))) - -(defun mastodon-notifications--test-type (fun sample) - "Test notification draw functions. - -FUN is the notificiation function to be called and SAMPLE is the -notification to be tested." - (let ((mastodon-tl--show-avatars-p nil) - (timestamp (cdr (assoc 'created_at sample)))) - (with-temp-buffer (funcall fun sample) - (buffer-substring-no-properties (point-min) (point-max))))) - -(ert-deftest mastodon-notifications--test-byline-concat () - "Ensure proper suffix is appended to action." - (should (and - (string= " Mentioned you" - (mastodon-notifications--byline-concat "Mentioned")) - (string= " Followed you" - (mastodon-notifications--byline-concat "Followed")) - (string= " Favourited your status from" - (mastodon-notifications--byline-concat "Favourited")) - (string= " Boosted your status from" - (mastodon-notifications--byline-concat "Boosted")) - (string= " Posted a post" - (mastodon-notifications--byline-concat "Posted"))))) - - diff --git a/test/mastodon-notifications-tests.el b/test/mastodon-notifications-tests.el new file mode 100644 index 0000000..f5cc4c5 --- /dev/null +++ b/test/mastodon-notifications-tests.el @@ -0,0 +1,217 @@ +;;; mastodon-notifications-tests.el --- Tests for mastodon-notifications.el -*- lexical-binding: nil -*- + +(require 'cl-lib) +(require 'cl-macs) +(require 'el-mock) + +(defconst mastodon-notifications--test-base-mentioned + '((id . "1234") + (type . "mention") + (created_at . "2018-03-06T04:27:21.288Z" ) + (account (id . 42) + (username . "acct42") + (acct . "acct42@example.space") + (display_name . "Account 42") + (locked . :json-false) + (created_at . "2017-04-01T00:00:00.000Z") + (followers_count . 99) + (following_count . 13) + (statuses_count . 101) + (note . "E")) + (status (id . 61208) + (created_at . "2017-04-24T19:01:02.000Z") + (in_reply_to_id) + (in_reply_to_account_id) + (sensitive . :json-false) + (spoiler_text . "") + (visibility . "public") + (account (id . 42) + (username . "acct42") + (acct . "acct42@example.space") + (display_name . "Account 42") + (locked . :json-false) + (created_at . "2017-04-01T00:00:00.000Z") + (followers_count . 99) + (following_count . 13) + (statuses_count . 101) + (note . "E")) + (media_attachments . []) + (mentions . []) + (tags . []) + (uri . "tag:example.space,2017-04-24:objectId=654321:objectType=Status") + (url . "https://example.space/users/acct42/updates/123456789") + (content . "

Just some text

") + (reblogs_count . 0) + (favourites_count . 0) + (reblog)))) + +(defconst mastodon-notifications--test-base-favourite + '((id . "1234") + (type . "favourite") + (created_at . "2018-03-06T04:27:21.288Z" ) + (account (id . 42) + (username . "acct42") + (acct . "acct42@example.space") + (display_name . "Account 42") + (locked . :json-false) + (created_at . "2017-04-01T00:00:00.000Z") + (followers_count . 99) + (following_count . 13) + (statuses_count . 101) + (note . "E")) + (status (id . 61208) + (created_at . "2017-04-24T19:01:02.000Z") + (in_reply_to_id) + (in_reply_to_account_id) + (sensitive . :json-false) + (spoiler_text . "") + (visibility . "public") + (account (id . 42) + (username . "acct42") + (acct . "acct42@example.space") + (display_name . "Account 42") + (locked . :json-false) + (created_at . "2017-04-01T00:00:00.000Z") + (followers_count . 99) + (following_count . 13) + (statuses_count . 101) + (note . "E")) + (media_attachments . []) + (mentions . []) + (tags . []) + (uri . "tag:example.space,2017-04-24:objectId=654321:objectType=Status") + (url . "https://example.space/users/acct42/updates/123456789") + (content . "

Just some text

") + (reblogs_count . 0) + (favourites_count . 0) + (reblog)))) + +(defconst mastodon-notifications--test-base-boosted + '((id . "1234") + (type . "reblog") + (created_at . "2018-03-06T04:27:21.288Z" ) + (account (id . 42) + (username . "acct42") + (acct . "acct42@example.space") + (display_name . "Account 42") + (locked . :json-false) + (created_at . "2017-04-01T00:00:00.000Z") + (followers_count . 99) + (following_count . 13) + (statuses_count . 101) + (note . "E")) + (status (id . 61208) + (created_at . "2017-04-24T19:01:02.000Z") + (in_reply_to_id) + (in_reply_to_account_id) + (sensitive . :json-false) + (spoiler_text . "") + (visibility . "public") + (account (id . 42) + (username . "acct42") + (acct . "acct42@example.space") + (display_name . "Account 42") + (locked . :json-false) + (created_at . "2017-04-01T00:00:00.000Z") + (followers_count . 99) + (following_count . 13) + (statuses_count . 101) + (note . "E")) + (media_attachments . []) + (mentions . []) + (tags . []) + (uri . "tag:example.space,2017-04-24:objectId=654321:objectType=Status") + (url . "https://example.space/users/acct42/updates/123456789") + (content . "

Just some text

") + (reblogs_count . 0) + (favourites_count . 0) + (reblog)))) + +(defconst mastodon-notifications--test-base-followed + '((id . "1234") + (type . "follow") + (created_at . "2018-03-06T04:27:21.288Z" ) + (account (id . 42) + (username . "acct42") + (acct . "acct42@example.space") + (display_name . "Account 42") + (locked . :json-false) + (created_at . "2017-04-01T00:00:00.000Z") + (followers_count . 99) + (following_count . 13) + (statuses_count . 101) + (note . "E")) + (status (id . 61208) + (created_at . "2017-04-24T19:01:02.000Z") + (in_reply_to_id) + (in_reply_to_account_id) + (sensitive . :json-false) + (spoiler_text . "") + (visibility . "public") + (account (id . 42) + (username . "acct42") + (acct . "acct42@example.space") + (display_name . "Account 42") + (locked . :json-false) + (created_at . "2017-04-01T00:00:00.000Z") + (followers_count . 99) + (following_count . 13) + (statuses_count . 101) + (note . "E")) + (media_attachments . []) + (mentions . []) + (tags . []) + (uri . "tag:example.space,2017-04-24:objectId=654321:objectType=Status") + (url . "https://example.space/users/acct42/updates/123456789") + (content . "

Just some text

") + (reblogs_count . 0) + (favourites_count . 0) + (reblog)))) + +(defconst mastodon-notifications--test-base-favourite + '((id . "1234") + (type . "mention") + (created_at . "2018-03-06T04:27:21.288Z" ) + (account (id . 42) + (username . "acct42") + (acct . "acct42@example.space") + (display_name . "Account 42") + (locked . :json-false) + (created_at . "2017-04-01T00:00:00.000Z") + (followers_count . 99) + (following_count . 13) + (statuses_count . 101) + (note . "E")))) + +(ert-deftest mastodon-notifications--notification-get () + "Ensure get request format for notifictions is accurate." + (let ((mastodon-instance-url "https://instance.url")) + (with-mock + (mock (mastodon-http--get-json "https://instance.url/api/v1/notifications" )) + (mastodon-notifications--get)))) + +(defun mastodon-notifications--test-type (fun sample) + "Test notification draw functions. + +FUN is the notificiation function to be called and SAMPLE is the +notification to be tested." + (let ((mastodon-tl--show-avatars-p nil) + (timestamp (cdr (assoc 'created_at sample)))) + (with-temp-buffer (funcall fun sample) + (buffer-substring-no-properties (point-min) (point-max))))) + +(ert-deftest mastodon-notifications--test-byline-concat () + "Ensure proper suffix is appended to action." + (should (and + (string= " Mentioned you" + (mastodon-notifications--byline-concat "Mentioned")) + (string= " Followed you" + (mastodon-notifications--byline-concat "Followed")) + (string= " Favourited your status from" + (mastodon-notifications--byline-concat "Favourited")) + (string= " Boosted your status from" + (mastodon-notifications--byline-concat "Boosted")) + (string= " Posted a post" + (mastodon-notifications--byline-concat "Posted"))))) + + -- cgit v1.2.3 From 1a66ec50e5a85910a55a83a827998d66bc3a96eb Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 27 Aug 2022 10:30:47 +0200 Subject: update ert-helper to load all tests files --- .woodpecker.yml | 2 +- test/ert-helper.el | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 26dc9d7..53952ec 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -3,5 +3,5 @@ pipeline: image: silex/emacs:cask commands: - cask install - - cask emacs -batch -l test/ert-helper.el -l test/*-tests.el -f ert-run-tests-batch-and-exit + - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit diff --git a/test/ert-helper.el b/test/ert-helper.el index f65649f..140425b 100644 --- a/test/ert-helper.el +++ b/test/ert-helper.el @@ -13,3 +13,11 @@ (load-file "lisp/mastodon-search.el") (load-file "lisp/mastodon-tl.el") (load-file "lisp/mastodon-toot.el") + +;; load tests in bulk to avoid using deprecated `cask exec' +(let ((tests (cl-remove-if-not (lambda (x) + (string-suffix-p "-tests.el" x)) + (directory-files "test/." t directory-files-no-dot-files-regexp)))) + (mapc #'load-file tests)) + + -- cgit v1.2.3 From 29e6750c606333b3fe06f55c99cfdffc2e04a3ff Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 27 Aug 2022 10:53:04 +0200 Subject: test profile buffer for - change time stamp for woodpecker --- test/mastodon-profile-tests.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/mastodon-profile-tests.el b/test/mastodon-profile-tests.el index ca323ea..817e386 100644 --- a/test/mastodon-profile-tests.el +++ b/test/mastodon-profile-tests.el @@ -272,12 +272,12 @@ content generation in the function under test." " ------------\n" "\n" "

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

\n" - " Eugen (@Gargron) 2021-11-11 12:11:11\n" + " Eugen (@Gargron) 2021-11-11 11:11:11\n" " ------------\n" "\n" "\n" "

@CCC At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

\n" - " Eugen (@Gargron) 2021-11-11 01:00:00\n" + " Eugen (@Gargron) 2021-11-11 00:00:00\n" " ------------\n" "\n" ))) -- cgit v1.2.3