whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: Add some tests for list_subscriptions|moderators
Date Mon, 15 Feb 2021 00:57:18 GMT
This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new c2fc73a  Add some tests for list_subscriptions|moderators
c2fc73a is described below

commit c2fc73a948da2ca5545f8d613460f44d7c3d785a
Author: Sebb <sebb@apache.org>
AuthorDate: Mon Feb 15 00:57:10 2021 +0000

    Add some tests for list_subscriptions|moderators
---
 lib/spec/lib/mail/mlist_spec.rb  | 54 ++++++++++++++++++++++++++++++++++++++++
 lib/test/subscriptions/list-mods |  2 ++
 2 files changed, 56 insertions(+)

diff --git a/lib/spec/lib/mail/mlist_spec.rb b/lib/spec/lib/mail/mlist_spec.rb
index 7a39e8c..dd04556 100644
--- a/lib/spec/lib/mail/mlist_spec.rb
+++ b/lib/spec/lib/mail/mlist_spec.rb
@@ -84,4 +84,58 @@ describe ASF::MLIST do
     end
   end
 
+  describe "ASF::MLIST.list_subscribers(mail_domain, podling=false, list_subs=false, skip_archivers=false)"
do
+    it "abcd should return an array of the form [Hash, Time]" do
+       res = ASF::MLIST.list_subscribers('abcd')
+       # array of Hash and Updated date
+       expect(res.class).to eq(Array)
+       expect(res.length).to eq(2)
+       list, stamp = res
+       expect(list.class).to eq(Hash)
+       expect(stamp.class).to eq(Time)
+       expect(list.size).to eq(0)
+    end
+    it "members should have some entries" do
+      list, _ = ASF::MLIST.list_subscribers('members')
+      if TEST_DATA
+        expect(list.size).to eq(1) # members
+        expect(list.keys.first).to eq('members@apache.org')
+      else
+        expect(list.size).to eq(2) # members and members-notify
+        expect(list.keys[0]).to eq('members@apache.org')
+        expect(list.keys[1]).to eq('members-notify@apache.org')
+      end
+   end
+  end
+  describe "ASF::MLIST.list_moderators(mail_domain, podling=false)" do
+    it "abcd should return an array of the form [Hash, Time]" do
+       res = ASF::MLIST.list_moderators('abcd')
+       # array of Hash and Updated date
+       expect(res.class).to eq(Array)
+       expect(res.length).to eq(2)
+       list, stamp = res
+       expect(list.class).to eq(Hash)
+       expect(stamp.class).to eq(Time)
+       expect(list.size).to eq(0)
+    end
+    it "members should have some entries" do
+      list, _ = ASF::MLIST.list_moderators('members')
+      if TEST_DATA
+        expect(list.size).to eq(1) # members
+        expect(list.keys.first).to eq('members@apache.org')
+        entry = list.first
+        expect(entry.class).to eq(Array)
+        expect(entry.size).to eq(2)
+        expect(entry[1].size).to eq(1) # number of moderators
+      else
+        expect(list.size).to eq(2) # members and members-notify
+        expect(list.keys[0]).to eq('members@apache.org')
+        expect(list.keys[1]).to eq('members-notify@apache.org')
+        entry = list.first
+        expect(entry.class).to eq(Array)
+        expect(entry.size).to eq(2)
+        expect(entry[1].size).to be_between(2, 5).inclusive # number of moderators
+      end
+   end
+  end
 end
diff --git a/lib/test/subscriptions/list-mods b/lib/test/subscriptions/list-mods
index 7db9149..9c7ebcb 100644
--- a/lib/test/subscriptions/list-mods
+++ b/lib/test/subscriptions/list-mods
@@ -1,3 +1,5 @@
+/home/apmail/lists/apache.org/members/mod
+mod-private@gsuite.cloud.apache.org
 
 /home/apmail/lists/apache.org/list1/mod
 mod-private@gsuite.cloud.apache.org


Mime
View raw message