Sha256: e4df17e75c00388cb9bdcfa922226d4dbb1662362171a6ac4ff9c90f2e6a1a93

Contents?: true

Size: 1.19 KB

Versions: 9

Compression:

Stored size: 1.19 KB

Contents

#!/usr/bin/env ruby

require 'TestSetup'
require 'test/unit'
require 'rubygems'
require_gem 'fireruby'

include FireRuby

class AddRemoveUserTest < Test::Unit::TestCase
   CURDIR      = "#{Dir.getwd}"
   DB_FILE     = "#{CURDIR}#{File::SEPARATOR}add_remove_user_unit_test.fdb"

   def setup
      # Remove existing database files.
      @database = Database.new(DB_FILE)
      if File.exist?(DB_FILE)
         @database.drop(DB_USER_NAME, DB_PASSWORD)
      end
      Database.create(DB_FILE, DB_USER_NAME, DB_PASSWORD)
   end

   def teardown
      # Remove existing database files.
      if File.exist?(DB_FILE)
         @database.drop(DB_USER_NAME, DB_PASSWORD)
      end
   end

   def test01
      sm = ServiceManager.new('localhost')
      sm.connect(DB_USER_NAME, DB_PASSWORD)

      au = AddUser.new('newuser', 'password', 'first', 'middle', 'last')
      au.execute(sm)

      cxn = @database.connect('newuser', 'password')
      cxn.close

      ru = RemoveUser.new('newuser')
      ru.execute(sm)

      begin
         cxn = @database.connect('newuser', 'password')
         cxn.close
         assert(false, "Able to connect as supposedly removed user.")
      rescue FireRubyException
      end
   end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fireruby-0.3.2-powerpc-darwin test/AddRemoveUserTest.rb
fireruby-0.3.2-mswin32 test/AddRemoveUserTest.rb
fireruby-0.3.2-i586-linux test/AddRemoveUserTest.rb
fireruby-0.3.1-powerpc-darwin test/AddRemoveUserTest.rb
fireruby-0.3.1-mswin32 test/AddRemoveUserTest.rb
fireruby-0.3.1-i586-linux test/AddRemoveUserTest.rb
fireruby-0.3.0-powerpc-darwin test/AddRemoveUserTest.rb
fireruby-0.3.0-mswin32 test/AddRemoveUserTest.rb
fireruby-0.3.0-i586-linux test/AddRemoveUserTest.rb