Sha256: 9f760e6598f4a6dbc568f60d7fc904a206a65cd34a7de072527fe444eef22879

Contents?: true

Size: 1.41 KB

Versions: 12

Compression:

Stored size: 1.41 KB

Contents

#!/usr/bin/env ruby

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

include FireRuby

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

   def setup
      puts "#{self.class.name} started." if TEST_LOGGING
      # 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
      puts "#{self.class.name} finished." if TEST_LOGGING
   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)
      sleep(3)

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

      ru = RemoveUser.new('newuser')
      ru.execute(sm)
      sleep(3)
      
      sm.disconnect

      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

12 entries across 12 versions & 2 rubygems

Version Path
rubyfb-0.5.4-x86-mswin32-60 test/AddRemoveUserTest.rb
rubyfb-0.5.4-x86-linux test/AddRemoveUserTest.rb
rubyfb-0.5.4 test/AddRemoveUserTest.rb
rubyfb-0.5.3-x86-mswin32-60 test/AddRemoveUserTest.rb
rubyfb-0.5.3-x86-linux test/AddRemoveUserTest.rb
rubyfb-0.5.3 test/AddRemoveUserTest.rb
rubyfb-0.5.2-x86-mswin32-60 test/AddRemoveUserTest.rb
rubyfb-0.5.2-x86-linux test/AddRemoveUserTest.rb
rubyfb-0.5.2 test/AddRemoveUserTest.rb
fireruby-0.4.3-mswin32 test/AddRemoveUserTest.rb
fireruby-0.4.3-i586-linux test/AddRemoveUserTest.rb
fireruby-0.4.2-mswin32 test/AddRemoveUserTest.rb