Sha256: 1892abc526f5596b57e940a74919963fd850a2ee4746cc6dcdf9a2bea44525ab

Contents?: true

Size: 1.36 KB

Versions: 4

Compression:

Stored size: 1.36 KB

Contents

require 'test_helper'

module Kaui
  class AdminTenantsControllerTest < Kaui::FunctionalTestHelper
    test "should get new" do
      post :new
      assert_response :success
    end

    test "should get create" do
      now = Time.now.to_s
      post :create, { :tenant => { :name => 'Goldorak_' + now, :api_key => '12345_' + now, :api_secret => 'ItH@st0beComplic@ted'}, :create_tenant => true}
      assert_response 302
    end


    test "should get index" do
      get :index
      assert_response :success
    end

    test "should get show with allowed user" do
      tenant = Kaui::Tenant.new
      tenant.name = 'foo'
      tenant.api_key = 'api_key'
      tenant.api_secret = 'api_secret'
      tenant.kb_tenant_id = 'kb_tenant_id'
      tenant.save!

      # Add an allowed user that will verify that we can only
      au = Kaui::AllowedUser.find_by_kb_username('admin')
      au.kaui_tenants << tenant

      get :show, :id => tenant.id
      assert_response :success
    end

    test "should get show with NO allowed user" do
      tenant = Kaui::Tenant.new
      tenant.name = 'foo'
      tenant.api_key = 'api_key'
      tenant.api_secret = 'api_secret'
      tenant.kb_tenant_id = 'kb_tenant_id'
      tenant.save!

      get :show, :id => tenant.id
      assert_response 302
      # Clear it before we call check_no_flash_error
      flash[:error] = nil
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kaui-0.11.0 test/functional/kaui/admin_tenants_controller_test.rb
kaui-0.10.0 test/functional/kaui/admin_tenants_controller_test.rb
kaui-0.9.0 test/functional/kaui/admin_tenants_controller_test.rb
kaui-0.8.4 test/functional/kaui/admin_tenants_controller_test.rb