environment_test.rb
7.04 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# require File.dirname(__FILE__) + '/../../../../../test/test_helper'
#
# class EnvironmentTest < ActiveSupport::TestCase
#
# def setup
# @enviroment = Environment.default
# end
#
# should 'have serpro_captcha_plugin variable defined' do
# assert_equal Hash, @enviroment.serpro_captcha_plugin.class
# end
#
# should 'return an empty hash by default on serpro_captcha_plugin_attributes method' do
# assert_equal Hash.new, @enviroment.serpro_captcha_plugin_attributes
# end
#
# should 'serpro_captcha_plugin_host= define the ldap host' do
# host = "http://something"
# @enviroment.serpro_captcha_plugin_host= host
# assert_equal host, @enviroment.serpro_captcha_plugin['host']
# end
#
# should 'serpro_captcha_plugin_host return the defined ldap host' do
# host = "http://something"
# @enviroment.serpro_captcha_plugin_host= host
# assert_equal host, @enviroment.serpro_captcha_plugin_host
# end
#
# should 'serpro_captcha_plugin_port= define the ldap port' do
# value = 255
# @enviroment.serpro_captcha_plugin_port= value
# assert_equal value, @enviroment.serpro_captcha_plugin['port']
# end
#
# should 'serpro_captcha_plugin_port return the defined ldap port' do
# value = 255
# @enviroment.serpro_captcha_plugin_port= value
# assert_equal value, @enviroment.serpro_captcha_plugin_port
# end
#
# should 'default serpro_captcha_plugin_port be 389' do
# assert_equal 389, @enviroment.serpro_captcha_plugin_port
# end
#
# should 'serpro_captcha_plugin_account= define the ldap acccount' do
# value = 'uid=sector,ou=Service,ou=corp,dc=company,dc=com,dc=br'
# @enviroment.serpro_captcha_plugin_account= value
# assert_equal value, @enviroment.serpro_captcha_plugin['account']
# end
#
# should 'serpro_captcha_plugin_account return the defined ldap account' do
# value = 'uid=sector,ou=Service,ou=corp,dc=company,dc=com,dc=br'
# @enviroment.serpro_captcha_plugin_account= value
# assert_equal value, @enviroment.serpro_captcha_plugin_account
# end
#
# should 'serpro_captcha_plugin_account_password= define the ldap acccount_password' do
# value = 'password'
# @enviroment.serpro_captcha_plugin_account_password= value
# assert_equal value, @enviroment.serpro_captcha_plugin['account_password']
# end
#
# should 'serpro_captcha_plugin_account_password return the defined ldap account password' do
# value = 'password'
# @enviroment.serpro_captcha_plugin_account_password= value
# assert_equal value, @enviroment.serpro_captcha_plugin_account_password
# end
#
# should 'serpro_captcha_plugin_base_dn= define the ldap base_dn' do
# value = 'dc=company,dc=com,dc=br'
# @enviroment.serpro_captcha_plugin_base_dn= value
# assert_equal value, @enviroment.serpro_captcha_plugin['base_dn']
# end
#
# should 'serpro_captcha_plugin_base_dn return the defined ldap base_dn' do
# value = 'dc=company,dc=com,dc=br'
# @enviroment.serpro_captcha_plugin_base_dn= value
# assert_equal value, @enviroment.serpro_captcha_plugin_base_dn
# end
#
# should 'serpro_captcha_plugin_attr_login= define the ldap attr_login' do
# value = 'uid'
# @enviroment.serpro_captcha_plugin_attr_login= value
# assert_equal value, @enviroment.serpro_captcha_plugin['attr_login']
# end
#
# should 'serpro_captcha_plugin_attr_login return the defined ldap attr_login' do
# value = 'uid'
# @enviroment.serpro_captcha_plugin_attr_login= value
# assert_equal value, @enviroment.serpro_captcha_plugin_attr_login
# end
#
# should 'serpro_captcha_plugin_attr_fullname= define the ldap attr_fullname' do
# value = 'Noosfero System'
# @enviroment.serpro_captcha_plugin_attr_fullname= value
# assert_equal value, @enviroment.serpro_captcha_plugin['attr_fullname']
# end
#
# should 'serpro_captcha_plugin_attr_fullname return the defined ldap attr_fullname' do
# value = 'uid'
# @enviroment.serpro_captcha_plugin_attr_fullname= value
# assert_equal value, @enviroment.serpro_captcha_plugin_attr_fullname
# end
#
#
# should 'serpro_captcha_plugin_attr_mail= define the ldap attr_mail' do
# value = 'test@noosfero.com'
# @enviroment.serpro_captcha_plugin_attr_mail= value
# assert_equal value, @enviroment.serpro_captcha_plugin['attr_mail']
# end
#
# should 'serpro_captcha_plugin_attr_mail return the defined ldap attr_mail' do
# value = 'test@noosfero.com'
# @enviroment.serpro_captcha_plugin_attr_mail= value
# assert_equal value, @enviroment.serpro_captcha_plugin_attr_mail
# end
#
# should 'serpro_captcha_plugin_onthefly_register= define the ldap onthefly_register' do
# value = '1'
# @enviroment.serpro_captcha_plugin_onthefly_register= value
# assert @enviroment.serpro_captcha_plugin['onthefly_register']
# end
#
# should 'serpro_captcha_plugin_onthefly_register return true if ldap onthefly_register variable is defined as true' do
# value = '1'
# @enviroment.serpro_captcha_plugin_onthefly_register= value
# assert @enviroment.serpro_captcha_plugin_onthefly_register
# end
#
# should 'serpro_captcha_plugin_onthefly_register return false if ldap onthefly_register variable is defined as false' do
# value = '0'
# @enviroment.serpro_captcha_plugin_onthefly_register= value
# refute @enviroment.serpro_captcha_plugin_onthefly_register
# end
#
# should 'serpro_captcha_plugin_filter= define the ldap filter' do
# value = 'test'
# @enviroment.serpro_captcha_plugin_filter= value
# assert_equal value, @enviroment.serpro_captcha_plugin['filter']
# end
#
# should 'serpro_captcha_plugin_filter return the defined ldap filter' do
# value = 'test'
# @enviroment.serpro_captcha_plugin_filter= value
# assert_equal value, @enviroment.serpro_captcha_plugin_filter
# end
#
# should 'serpro_captcha_plugin_tls= define the ldap tls' do
# value = '1'
# @enviroment.serpro_captcha_plugin_tls= value
# assert @enviroment.serpro_captcha_plugin['tls']
# end
#
# should 'tls return true if ldap tls variable is defined as true' do
# value = '1'
# @enviroment.serpro_captcha_plugin_tls= value
# assert @enviroment.serpro_captcha_plugin_tls
# end
#
# should 'tls return false if ldap tls variable is defined as false' do
# value = '0'
# @enviroment.serpro_captcha_plugin_tls= value
# refute @enviroment.serpro_captcha_plugin_tls
# end
#
# should 'validates presence of host' do
# @enviroment.serpro_captcha_plugin= {:port => 3000}
# @enviroment.valid?
#
# assert @enviroment.errors.include?(:serpro_captcha_plugin_host)
#
# @enviroment.serpro_captcha_plugin_host= "http://somehost.com"
# @enviroment.valid?
# refute @enviroment.errors.include?(:serpro_captcha_plugin_host)
# end
#
# should 'validates presence of host only if some ldap configuration is defined' do
# @enviroment.valid?
# refute @enviroment.errors.include?(:serpro_captcha_plugin_host)
#
# @enviroment.serpro_captcha_plugin= {:port => 3000}
# @enviroment.valid?
# assert @enviroment.errors.include?(:serpro_captcha_plugin_host)
# end
#
# end