authpds 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +1 -1
- data/README.rdoc +28 -7
- data/Rakefile +1 -6
- data/lib/authpds.rb +0 -2
- data/lib/authpds/acts_as_authentic.rb +19 -17
- data/lib/authpds/controllers/authpds_controller.rb +51 -54
- data/lib/authpds/controllers/authpds_sessions_controller.rb +20 -20
- data/lib/authpds/exlibris/pds.rb +1 -7
- data/lib/authpds/session.rb +29 -28
- data/lib/authpds/version.rb +1 -1
- data/test/support/user.rb +6 -6
- data/test/test_helper.rb +1 -1
- data/test/unit/authpds_controller_test.rb +9 -10
- data/test/unit/authpds_user_sessions_controller_test.rb +2 -2
- data/test/unit/pds_test.rb +8 -21
- data/test/unit/user_session_test.rb +20 -22
- data/test/unit/user_test.rb +21 -15
- metadata +28 -14
- data/lib/authpds/institution.rb +0 -44
- data/lib/authpds/institution_list.rb +0 -75
- data/test/support/config/institutions2.yml +0 -352
- data/test/unit/institution_list_test.rb +0 -63
- data/test/unit/institution_test.rb +0 -17
| @@ -1,63 +0,0 @@ | |
| 1 | 
            -
            require 'test_helper'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            class InstitutionListTest < ActiveSupport::TestCase
         | 
| 4 | 
            -
             | 
| 5 | 
            -
              def setup
         | 
| 6 | 
            -
                InstitutionList.class_variable_set(:@@institutions_yaml_path, nil)
         | 
| 7 | 
            -
                InstitutionList.instance.instance_variable_set(:@institutions, nil)
         | 
| 8 | 
            -
                @yaml_path = "#{File.dirname(__FILE__)}/../support/config/institutions.yml"
         | 
| 9 | 
            -
                @yaml2_path = "#{File.dirname(__FILE__)}/../support/config/institutions2.yml"
         | 
| 10 | 
            -
              end
         | 
| 11 | 
            -
              
         | 
| 12 | 
            -
              test "yaml_path" do
         | 
| 13 | 
            -
                assert_raise ArgumentError do
         | 
| 14 | 
            -
                  InstitutionList.yaml_path=  nil
         | 
| 15 | 
            -
                end
         | 
| 16 | 
            -
                assert_raise NameError do
         | 
| 17 | 
            -
                  InstitutionList.yaml_path= "garbage_path"
         | 
| 18 | 
            -
                end
         | 
| 19 | 
            -
                assert_nothing_raised do
         | 
| 20 | 
            -
                  InstitutionList.yaml_path= @yaml_path
         | 
| 21 | 
            -
                  InstitutionList.instance.institutions
         | 
| 22 | 
            -
                end
         | 
| 23 | 
            -
              end
         | 
| 24 | 
            -
              
         | 
| 25 | 
            -
              test "defined" do
         | 
| 26 | 
            -
                assert(!InstitutionList.institutions_defined?)
         | 
| 27 | 
            -
                InstitutionList.yaml_path= @yaml_path
         | 
| 28 | 
            -
                assert(InstitutionList.institutions_defined?)
         | 
| 29 | 
            -
              end
         | 
| 30 | 
            -
              
         | 
| 31 | 
            -
              test "defaults" do
         | 
| 32 | 
            -
                assert_raise ArgumentError do
         | 
| 33 | 
            -
                  InstitutionList.instance.defaults
         | 
| 34 | 
            -
                end
         | 
| 35 | 
            -
                assert_nothing_raised do
         | 
| 36 | 
            -
                  InstitutionList.yaml_path= @yaml_path
         | 
| 37 | 
            -
                  InstitutionList.instance.defaults
         | 
| 38 | 
            -
                end
         | 
| 39 | 
            -
                assert_not_nil(InstitutionList.instance.defaults)
         | 
| 40 | 
            -
                assert_equal([InstitutionList.instance.get("NYUAD")], InstitutionList.instance.defaults)
         | 
| 41 | 
            -
              end
         | 
| 42 | 
            -
              
         | 
| 43 | 
            -
              test "institutions_with_ip" do
         | 
| 44 | 
            -
                assert_raise ArgumentError do
         | 
| 45 | 
            -
                  InstitutionList.instance.institutions_with_ip "128.122.149.122"
         | 
| 46 | 
            -
                end
         | 
| 47 | 
            -
                assert_nothing_raised do
         | 
| 48 | 
            -
                  InstitutionList.yaml_path= @yaml_path
         | 
| 49 | 
            -
                  InstitutionList.instance.institutions_with_ip "128.122.149.122"
         | 
| 50 | 
            -
                end
         | 
| 51 | 
            -
                assert_not_nil(InstitutionList.instance.institutions_with_ip "128.122.149.122")
         | 
| 52 | 
            -
                assert_equal([InstitutionList.instance.get("NYU")], InstitutionList.instance.institutions_with_ip("128.122.149.122"))
         | 
| 53 | 
            -
              end
         | 
| 54 | 
            -
              
         | 
| 55 | 
            -
              test "parents" do
         | 
| 56 | 
            -
                institution_list = YAML.load_file( @yaml2_path )
         | 
| 57 | 
            -
                # nyu = institution_list["NYU"]
         | 
| 58 | 
            -
                # puts "Test:#{institution_list}"
         | 
| 59 | 
            -
                InstitutionList.yaml_path= @yaml2_path
         | 
| 60 | 
            -
                InstitutionList.instance.institutions
         | 
| 61 | 
            -
                
         | 
| 62 | 
            -
              end
         | 
| 63 | 
            -
            end
         | 
| @@ -1,17 +0,0 @@ | |
| 1 | 
            -
            require 'test_helper'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            class InstitutionTest < ActiveSupport::TestCase
         | 
| 4 | 
            -
             | 
| 5 | 
            -
              def setup
         | 
| 6 | 
            -
              end
         | 
| 7 | 
            -
              
         | 
| 8 | 
            -
              test "default" do
         | 
| 9 | 
            -
                default_name_institution = Institution.new({"name" => "default"})
         | 
| 10 | 
            -
                assert(default_name_institution.default, "Default name didn't work.")
         | 
| 11 | 
            -
                regular_institution = Institution.new({"name" => "not_default"})
         | 
| 12 | 
            -
                assert(!regular_institution.default, "Default attribute didn't work.")
         | 
| 13 | 
            -
                default_attribute_institution = Institution.new({"name" => "not_default", "default" => "true"})
         | 
| 14 | 
            -
                assert(default_attribute_institution.default)
         | 
| 15 | 
            -
              end
         | 
| 16 | 
            -
              
         | 
| 17 | 
            -
            end
         |