pasaporte 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +2 -0
- data/Manifest.txt +41 -0
- data/README.txt +72 -0
- data/Rakefile +111 -0
- data/TODO.txt +2 -0
- data/bin/pasaporte-fcgi.rb +17 -0
- data/lib/pasaporte/.DS_Store +0 -0
- data/lib/pasaporte/assets/.DS_Store +0 -0
- data/lib/pasaporte/assets/bgbar.png +0 -0
- data/lib/pasaporte/assets/lock.png +0 -0
- data/lib/pasaporte/assets/mainbg_green.gif +0 -0
- data/lib/pasaporte/assets/mainbg_red.gif +0 -0
- data/lib/pasaporte/assets/openid.png +0 -0
- data/lib/pasaporte/assets/pasaporte.css +192 -0
- data/lib/pasaporte/assets/pasaporte.js +10 -0
- data/lib/pasaporte/assets/user.png +0 -0
- data/lib/pasaporte/auth/cascade.rb +16 -0
- data/lib/pasaporte/auth/remote_web_workplace.rb +61 -0
- data/lib/pasaporte/auth/yaml_digest_table.rb +23 -0
- data/lib/pasaporte/auth/yaml_table.rb +43 -0
- data/lib/pasaporte/faster_openid.rb +39 -0
- data/lib/pasaporte/iso_countries.yml +247 -0
- data/lib/pasaporte/julik_state.rb +42 -0
- data/lib/pasaporte/markaby_ext.rb +8 -0
- data/lib/pasaporte/pasaporte_store.rb +60 -0
- data/lib/pasaporte/timezones.yml +797 -0
- data/lib/pasaporte.rb +1214 -0
- data/test/fixtures/pasaporte_approvals.yml +12 -0
- data/test/fixtures/pasaporte_profiles.yml +45 -0
- data/test/fixtures/pasaporte_throttles.yml +4 -0
- data/test/helper.rb +66 -0
- data/test/mosquito.rb +596 -0
- data/test/test_approval.rb +33 -0
- data/test/test_auth_backends.rb +59 -0
- data/test/test_openid.rb +363 -0
- data/test/test_pasaporte.rb +326 -0
- data/test/test_profile.rb +165 -0
- data/test/test_settings.rb +27 -0
- data/test/test_throttle.rb +70 -0
- data/test/testable_openid_fetcher.rb +82 -0
- metadata +151 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
monsieur_hulot_and_playtime:
|
2
|
+
id: 1
|
3
|
+
profile_id: 1
|
4
|
+
trust_root: http://playtime.fr/
|
5
|
+
monsieur_hulot_and_imdb:
|
6
|
+
id: 2
|
7
|
+
profile_id: 1
|
8
|
+
trust_root: http://www.imdb.com/title/tt0062136/
|
9
|
+
julik_and_openidenabled:
|
10
|
+
id: 3
|
11
|
+
profile_id: 2
|
12
|
+
trust_root: http://openidenabled.com
|
@@ -0,0 +1,45 @@
|
|
1
|
+
monsieur_hulot:
|
2
|
+
id: 1
|
3
|
+
nickname: "monsieur-hulot"
|
4
|
+
domain_name: "test.host"
|
5
|
+
dob: <%= Date.parse("12-01-1953").to_s(:db) %>
|
6
|
+
fullname: Monsieur Hulot
|
7
|
+
gender: 'm'
|
8
|
+
country: fr
|
9
|
+
shared: 1
|
10
|
+
postcode: 1234
|
11
|
+
info: " C'est alors que j'ai eu l'idée de présenter monsieur Hulot,
|
12
|
+
personnage d'une indépendance complète, d'un désintéressement absolu
|
13
|
+
et dont l'étourderie, qui est son principal défaut, en fait, à notre
|
14
|
+
époque fonctionnelle, un inadapté."
|
15
|
+
|
16
|
+
julik:
|
17
|
+
id: 2
|
18
|
+
nickname: "julik"
|
19
|
+
domain_name: "test.host"
|
20
|
+
dob: <%= Date.parse("15-10-1983").to_s(:db) %>
|
21
|
+
fullname: Julik Tarkhanov
|
22
|
+
gender: 'm'
|
23
|
+
country: nl
|
24
|
+
shared: 0
|
25
|
+
postcode: 1234
|
26
|
+
info: "Wrote Pasaporte"
|
27
|
+
|
28
|
+
max:
|
29
|
+
id: 3
|
30
|
+
nickname: "max"
|
31
|
+
domain_name: "test.host"
|
32
|
+
dob: <%= Date.parse("15-10-1983").to_s(:db) %>
|
33
|
+
fullname: Max Lapshin
|
34
|
+
gender: 'm'
|
35
|
+
country: ru
|
36
|
+
shared: 1
|
37
|
+
postcode: 3524
|
38
|
+
info: "Promised to help with Pasaporte but didn't"
|
39
|
+
|
40
|
+
delegated_profile:
|
41
|
+
id: 4
|
42
|
+
nickname: "hans"
|
43
|
+
domain_name: "test.host"
|
44
|
+
openid_server: "http://hans.myopenid.com"
|
45
|
+
openid_delegate: "http://hans.myopenid.com"
|
data/test/helper.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
#gem 'activesupport', '<=2.0.2'
|
3
|
+
$:.reject! { |e| e.include? 'TextMate' }
|
4
|
+
|
5
|
+
require File.dirname(__FILE__) + '/../lib/pasaporte'
|
6
|
+
require File.dirname(__FILE__) + '/mosquito'
|
7
|
+
|
8
|
+
require 'flexmock'
|
9
|
+
require 'flexmock/test_unit'
|
10
|
+
|
11
|
+
# for assert_select and friends
|
12
|
+
require 'action_controller'
|
13
|
+
require 'action_controller/assertions'
|
14
|
+
|
15
|
+
class Pasaporte::Controllers::ServerError
|
16
|
+
def get(*all)
|
17
|
+
raise all.pop
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + "/fixtures/"
|
22
|
+
ActiveRecord::Base.logger = Logger.new("/dev/null") # SAILENS!
|
23
|
+
Pasaporte::LOGGER.level = Logger::ERROR
|
24
|
+
|
25
|
+
def mock_auth(log, pass, dom)
|
26
|
+
logins = %w(monsieur-hulot julian jamesbrown)
|
27
|
+
passes = logins.map(&:reverse)
|
28
|
+
logins.index(log) && (logins.index(log) == passes.index(pass))
|
29
|
+
end
|
30
|
+
|
31
|
+
test_logger = Logger.new(File.dirname(__FILE__) + "/test.log")
|
32
|
+
|
33
|
+
silence_warnings do
|
34
|
+
Pasaporte.const_set(:LOGGER, test_logger)
|
35
|
+
Pasaporte.const_set(:AUTH, lambda{|l, p, d| mock_auth(l, p, d) })
|
36
|
+
end
|
37
|
+
ActiveRecord::Base.logger = test_logger
|
38
|
+
|
39
|
+
ActiveRecord::Migration.suppress_messages { Pasaporte.create }
|
40
|
+
|
41
|
+
include Pasaporte::Models
|
42
|
+
|
43
|
+
class Pasaporte::WebTest < Camping::WebTest
|
44
|
+
if respond_to?(:set_fixture_class)
|
45
|
+
set_fixture_class :pasaporte_approvals => Pasaporte::Models::Approval,
|
46
|
+
:pasaporte_profiles => Pasaporte::Models::Profile,
|
47
|
+
:pasaporte_throttles => Pasaporte::Models::Throttle
|
48
|
+
end
|
49
|
+
|
50
|
+
def setup
|
51
|
+
super; @class_name_abbr = 'Pasaporte'
|
52
|
+
end
|
53
|
+
|
54
|
+
def prelogin(login)
|
55
|
+
flexmock(Pasaporte::AUTH).
|
56
|
+
should_receive(:call).with(login, "schweet", @request.domain).once.and_return(true)
|
57
|
+
post "/#{login}/signon", :pass => "schweet"
|
58
|
+
end
|
59
|
+
|
60
|
+
attr_reader :html_document
|
61
|
+
def send_request(*a)
|
62
|
+
returning(super(*a)) do
|
63
|
+
@html_document = HTML::Document.new(@response.body.to_s) unless @response.headers["Location"]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|