def setup
@pw_enc = Rucy::PasswordEncryptor.new
@crypt_call = 0
@factory = Rucy::DocumentFactory.new
page = Object.new
def page.doc_name
'Page'
end
def page.doc_args
[ [ 'content', :text, nil ],
[ 'content-type', :string, 'text/html' ]
]
end
@factory.add_document(page)
local = Object.new
def local.doc_name
'LocalFile'
end
def local.doc_args
[ [ 'local path', :string, nil ] ]
end
@factory.add_document(local)
test_args = Object.new
def test_args.doc_name
'TestArguments'
end
def test_args.doc_args
[ [ 'string', :string, nil ],
[ 'text', :text, nil ],
[ 'number', :number, nil ],
[ 'bool', :bool, false ],
[ 'select', :select, %[ foo bar baz ] ],
[ 'checkset', :checkset, [
[ 'foo', false ],
[ 'bar', false ],
[ 'baz', false ]
]
],
[ 'radio', :radio, %[ foo bar baz ] ],
[ 'password', :password, nil ],
[ 'regexp', :regexp, nil ]
]
end
@factory.add_document(test_args)
@default_path_call = 0
@default_path = nil
@default_mask_type_call = 0
@default_mask_type = nil
@default_mask_call = 0
@default_mask = nil
@default_virtual_host_call = 0
@default_virtual_host = nil
@default_comment_call = 0
@default_comment = nil
@doc_tag_call = 0
@doc_label_call = 0
@path_tag_call = 0
@path_label_call = 0
@mask_tag_call = 0
@mask_label_call = 0
@modified_count_call = 0
@set_modified_count_call = 0
@set_modified_count_last_value = nil
@doc_pos_call = 0
@doc_type_call = 0
@document_list_call = 0
@document_list = [
{ 'document' => 'Page',
'arguments' => [
"Hello world.\n",
'text/plain'
],
'mount_path' => '/hello',
'mount_mask' => 'index.html',
'virtual_host' => nil,
'comment' => 'test of Page'
},
{ 'document' => 'LocalFile',
'arguments' => [
'/home/alice/public_html'
],
'mount_path' => '/~alice',
'mount_mask' => nil,
'virtual_host' => 'foo',
'comment' => 'test of LocalFile'
},
{ 'document' => 'TestArguments',
'arguments' => [
'test_string',
'test_text',
0,
true,
'bar',
{ 'foo' => true,
'bar' => false,
'baz' => false
},
'baz',
'himitsu',
/foo/
],
'mount_path' => '/args',
'mount_mask' => nil,
'virtual_host' => nil,
'comment' => 'test of Arguments'
},
]
@doc_args_call = 0
@write_document_list_call = 0
@cancel_call = 0
loader = WPM::Loader.new('../control/EditProperties/EditProperties.rb')
@EditProperties = loader.const_get('EditProperties').new(self, :control => self, :pw_enc => self)
assert((@EditProperties.is_a? WPM::PageContext))
@EditProperties.init_context
@EditProperties.properties_source = self
assert_equal(1, @doc_pos_call)
assert_equal(1, @doc_type_call)
end