[milter-manager-commit] milter-manager/milter-manager at 9c6bc52 [master] binding ruby: Add test for RspamdProxyDetector

Back to archive index

Kenji Okimoto null+****@clear*****
Tue Jun 27 12:17:42 JST 2017


Kenji Okimoto	2017-06-27 12:17:42 +0900 (Tue, 27 Jun 2017)

  New Revision: 9c6bc52890ebbcf14837cfe6a7123cc781db1064
  https://github.com/milter-manager/milter-manager/commit/9c6bc52890ebbcf14837cfe6a7123cc781db1064

  Merged 8a5f2c2: Merge pull request #126 from milter-manager/auto-detect-rspamd-proxy

  Message:
    binding ruby: Add test for RspamdProxyDetector

  Added files:
    binding/ruby/test/manager/test-rspamd-proxy-detector.rb
  Modified files:
    binding/ruby/test/run-test.rb

  Added: binding/ruby/test/manager/test-rspamd-proxy-detector.rb (+22 -0) 100644
===================================================================
--- /dev/null
+++ binding/ruby/test/manager/test-rspamd-proxy-detector.rb    2017-06-27 12:17:42 +0900 (df5ea28)
@@ -0,0 +1,22 @@
+class TestRspamdProxyDetector < Test::Unit::TestCase
+  data(default: ["*:11332", "inet:11332 at localhost"],
+       host: ["mail.example.com:11332", "inet:11332****@mail*****"])
+  test "detect" do |(bind_socket, expected)|
+    detector = ::Milter::Manager::RspamdProxyDetector.new
+    mock(File).executable?("/usr/bin/rspamadm") { true }
+    mock(detector). __double_definition_create__.call("`".to_sym, "/usr/bin/rspamadm configdump --json") do
+      {
+        "worker" => [
+          {
+            "rspamd_proxy" => {
+              "bind_socket" => bind_socket,
+              "milter" => true
+            }
+          }
+        ]
+      }.to_json
+    end
+
+    assert_equal(expected, detector.detect)
+  end
+end

  Modified: binding/ruby/test/run-test.rb (+1 -0)
===================================================================
--- binding/ruby/test/run-test.rb    2017-06-26 18:22:03 +0900 (903ff2c)
+++ binding/ruby/test/run-test.rb    2017-06-27 12:17:42 +0900 (93933f6)
@@ -23,6 +23,7 @@ top = (base + "..").expand_path
 test_unit_dir = top + "test-unit" + "lib"
 $LOAD_PATH.unshift(test_unit_dir.to_s)
 require 'test/unit'
+require 'test/unit/rr'
 
 require 'milter/manager'
 
-------------- next part --------------
An HTML attachment was scrubbed...
Download 



More information about the milter-manager-commit mailing list
Back to archive index