summaryrefslogtreecommitdiff
path: root/t/test-ldap-probe.rb
blob: 4e552b420f1c49b82bf6c61383b9b02dcbe13cc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/ruby -Ilib/ -I../lib/


require 'test/unit'

require 'custodian/protocoltests'



class TestLDAPProbe < Test::Unit::TestCase

  #
  # Create the test suite environment: NOP.
  #
  def setup
  end

  #
  # Destroy the test suite environment: NOP.
  #
  def teardown
  end


  #
  # Test the sanity of a good test.
  #
  def test_expected_usage
    test = nil

    assert_nothing_raised do
     test = Custodian::TestFactory.create( "auth.bytemark.co.uk must run ldap on 389 with username 'testing' with password 'bob' otherwise 'LDAP dead?'." )
    end

    assert( test )
    assert_equal( test.get_type, "ldap" )
  end



  #
  #  Ensure missing a test raises an error.
  #
  def test_missing_ldap()
    #
    # test data
    #
    data = [
            "foo.example.com must run ldap on 389.",
            "foo.example.com must run ldap with username 'test'.",
            "foo.example.com must run ldap with uername 'test' with password 'x'."
    ]

    #
    #  For each test
    #
    data.each do |str|
      assert_raise ArgumentError do
        test = Custodian::TestFactory.create( str )
      end
    end
  end

end