Sha256: 60e789923d62df0597cebdcc7dc06369a0dfb296adb9198fd00770b762b7f111

Contents?: true

Size: 1.49 KB

Versions: 6

Compression:

Stored size: 1.49 KB

Contents

#!/usr/bin/env ruby

require './TestSetup'
require 'test/unit'
require 'rubygems'
require 'rubyfb'

include Rubyfb

class AddRemoveUserTest < Test::Unit::TestCase
   DB_FILE     = File.join(DB_DIR, "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)

      begin
        ru = RemoveUser.new('newuser')
        ru.execute(sm)
        sleep(3)
      rescue
      end

      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

6 entries across 6 versions & 1 rubygems

Version Path
rubyfb-0.6.7 test/AddRemoveUserTest.rb
rubyfb-0.6.4 test/AddRemoveUserTest.rb
rubyfb-0.6.3 test/AddRemoveUserTest.rb
rubyfb-0.6.2 test/AddRemoveUserTest.rb
rubyfb-0.6.1 test/AddRemoveUserTest.rb
rubyfb-0.6 test/AddRemoveUserTest.rb