You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2019/03/08 15:11:35 UTC

[whimsy] branch master updated: Some more tests of mlist

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 7af80a5  Some more tests of mlist
7af80a5 is described below

commit 7af80a545a94ca61e47e57cbd0cf7a9fcb09482d
Author: Sebb <se...@apache.org>
AuthorDate: Fri Mar 8 15:11:34 2019 +0000

    Some more tests of mlist
---
 lib/spec/lib/mail/mlist_spec.rb | 85 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/lib/spec/lib/mail/mlist_spec.rb b/lib/spec/lib/mail/mlist_spec.rb
new file mode 100644
index 0000000..859a79c
--- /dev/null
+++ b/lib/spec/lib/mail/mlist_spec.rb
@@ -0,0 +1,85 @@
+# encoding: utf-8
+# frozen_string_literal: true
+require 'spec_helper'
+require 'whimsy/asf'
+require 'whimsy/asf/mlist' # not loaded by default
+
+describe ASF::MLIST do
+
+  describe "ASF::MLIST.members_subscribers" do
+    it "should return an array of members@ subscribers followed by the file update time" do
+      res = ASF::MLIST.members_subscribers()
+      expect(res.class).to eq(Array)
+      expect(res.length).to eq(2)
+      subs,stamp = res
+      expect(subs.class).to eq(Array)
+      expect(stamp.class).to eq(Time)
+      expect(subs.length).to be_between(500, 1000).inclusive
+    end
+  end
+
+  describe "ASF::MLIST.list_archivers" do
+    it "should return array of form [dom, list, [[archiver, type, alias|direct],...]" do
+      ASF::MLIST.list_archivers do |res|
+        expect(res.class).to eq(Array)
+        expect(res.length).to eq(3)
+        dom,list,arches = res # unpack
+        expect(dom.class).to eq(String)
+        expect(list.class).to eq(String)
+        expect(arches.class).to eq(Array)
+        expect(arches[0].length).to eq(3)
+      end
+    end
+  end
+
+  describe "ASF::MLIST.moderates(user_emails, response)" do
+    it "should not find any entries for invalid emails" do
+      user_emails=['user@localhost', 'user@domain.invalid']
+      res = ASF::MLIST.moderates(user_emails)
+      expect(res.length).to eq(2)
+      mods = res[:moderates]
+      expect(mods.length).to eq(0)
+    end
+
+    it "should find some entries for mod-private@gsuite.cloud.apache.org" do
+      user_emails=['mod-private@gsuite.cloud.apache.org']
+      res = ASF::MLIST.moderates(user_emails)
+      expect(res.length).to eq(2)
+      mods = res[:moderates]
+      expect(mods.length).to be_between(8, 20)
+    end
+  end
+
+  describe "ASF::MLIST.subscriptions(user_emails, response)" do
+    it "should not find any entries for invalid emails" do
+      user_emails=['user@localhost', 'user@domain.invalid']
+      res = ASF::MLIST.subscriptions(user_emails)
+      expect(res.length).to eq(2)
+      mods = res[:subscriptions]
+      expect(mods.length).to eq(0)
+    end
+  end
+
+  it "should find lots of entries for archiver@mbox-vm.apache.org" do
+    user_emails=['archiver@mbox-vm.apache.org']
+    res = ASF::MLIST.subscriptions(user_emails)
+    expect(res.length).to eq(2)
+    mods = res[:subscriptions]
+    expect(mods.length).to be_between(1000, 1200)
+  end
+
+  describe "ASF::MLIST.each_list" do
+    it "should return an array of form [[dom, list],...]" do
+      ASF::MLIST.each_list do |res|
+        expect(res.class).to eq(Array)
+        expect(res.length).to eq(2)
+        dom,list = res # unpack
+        expect(dom.class).to eq(String)
+        expect(list.class).to eq(String)
+        expect(dom).to match(/^[a-z.0-9-]+\.[a-z]+$/)
+        expect(list).to match(/^[a-z0-9-]+$/)
+      end
+    end
+  end
+
+end