stackmob 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -7
- data/bin/stackmob +5 -0
- data/lib/stackmob.rb +30 -4
- data/lib/stackmob/cli/local_server.rb +60 -0
- data/lib/stackmob/cli/main.rb +33 -0
- data/lib/stackmob/client.rb +21 -11
- data/lib/stackmob/middleware/proxy.rb +68 -0
- data/lib/stackmob/middleware/rewrite.rb +50 -0
- data/lib/stackmob/tasks.rb +1 -1
- metadata +121 -68
- data/.document +0 -5
- data/Gemfile +0 -16
- data/Gemfile.lock +0 -47
- data/Rakefile +0 -59
- data/VERSION +0 -1
- data/stackmob.gemspec +0 -100
- data/test/helper.rb +0 -22
- data/test/integration/test_client.rb +0 -45
- data/test/integration/test_data_store.rb +0 -31
- data/test/integration/test_deployer.rb +0 -23
- data/test/integration/test_push.rb +0 -24
- data/test/integration_helper.rb +0 -46
- data/test/unit/stackmob/rack/test_simple_oauth_provider.rb +0 -52
- data/test/unit/stackmob/test_client.rb +0 -105
- data/test/unit/stackmob/test_data_store.rb +0 -83
- data/test/unit/stackmob/test_deployer.rb +0 -21
- data/test/unit/stackmob/test_push.rb +0 -133
- data/test/unit/test_stackmob.rb +0 -129
data/.document
DELETED
data/Gemfile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
|
3
|
-
gem "oauth", "~> 0.4.5"
|
4
|
-
gem "yajl-ruby", "~> 0.8.2", :require => "yajl"
|
5
|
-
|
6
|
-
group :development do
|
7
|
-
gem "minitest", ">= 0"
|
8
|
-
gem "yard", "~> 0.6.0"
|
9
|
-
gem "cucumber", ">= 0"
|
10
|
-
gem "bundler", "~> 1.0.0"
|
11
|
-
gem "jeweler", "~> 1.6.4"
|
12
|
-
gem "rcov", ">= 0"
|
13
|
-
gem "mocha", ">= 0"
|
14
|
-
gem "rack-test"
|
15
|
-
gem "bluecloth"
|
16
|
-
end
|
data/Gemfile.lock
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
bluecloth (2.1.0)
|
5
|
-
builder (3.0.0)
|
6
|
-
cucumber (1.0.2)
|
7
|
-
builder (>= 2.1.2)
|
8
|
-
diff-lcs (>= 1.1.2)
|
9
|
-
gherkin (~> 2.4.5)
|
10
|
-
json (>= 1.4.6)
|
11
|
-
term-ansicolor (>= 1.0.5)
|
12
|
-
diff-lcs (1.1.2)
|
13
|
-
gherkin (2.4.5)
|
14
|
-
json (>= 1.4.6)
|
15
|
-
git (1.2.5)
|
16
|
-
jeweler (1.6.4)
|
17
|
-
bundler (~> 1.0)
|
18
|
-
git (>= 1.2.5)
|
19
|
-
rake
|
20
|
-
json (1.5.3)
|
21
|
-
minitest (2.3.1)
|
22
|
-
mocha (0.9.12)
|
23
|
-
oauth (0.4.5)
|
24
|
-
rack (1.3.2)
|
25
|
-
rack-test (0.6.1)
|
26
|
-
rack (>= 1.0)
|
27
|
-
rake (0.9.2)
|
28
|
-
rcov (0.9.9)
|
29
|
-
term-ansicolor (1.0.6)
|
30
|
-
yajl-ruby (0.8.2)
|
31
|
-
yard (0.6.8)
|
32
|
-
|
33
|
-
PLATFORMS
|
34
|
-
ruby
|
35
|
-
|
36
|
-
DEPENDENCIES
|
37
|
-
bluecloth
|
38
|
-
bundler (~> 1.0.0)
|
39
|
-
cucumber
|
40
|
-
jeweler (~> 1.6.4)
|
41
|
-
minitest
|
42
|
-
mocha
|
43
|
-
oauth (~> 0.4.5)
|
44
|
-
rack-test
|
45
|
-
rcov
|
46
|
-
yajl-ruby (~> 0.8.2)
|
47
|
-
yard (~> 0.6.0)
|
data/Rakefile
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'bundler'
|
5
|
-
begin
|
6
|
-
Bundler.setup(:default, :development)
|
7
|
-
rescue Bundler::BundlerError => e
|
8
|
-
$stderr.puts e.message
|
9
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
-
exit e.status_code
|
11
|
-
end
|
12
|
-
require 'rake'
|
13
|
-
|
14
|
-
require 'jeweler'
|
15
|
-
Jeweler::Tasks.new do |gem|
|
16
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
-
gem.name = "stackmob"
|
18
|
-
gem.homepage = "http://github.com/stackmob/stackmob-ruby"
|
19
|
-
gem.license = "MIT"
|
20
|
-
gem.summary = "Support Gem for StackMob Heroku Add-On"
|
21
|
-
gem.description = "Support Gem for StackMob Heroku Add-On"
|
22
|
-
gem.email = "jordan@stackmob.com"
|
23
|
-
gem.authors = ["StackMob"]
|
24
|
-
# dependencies defined in Gemfile
|
25
|
-
end
|
26
|
-
Jeweler::RubygemsDotOrgTasks.new
|
27
|
-
|
28
|
-
require 'rake/testtask'
|
29
|
-
require 'rcov/rcovtask'
|
30
|
-
namespace :test do
|
31
|
-
|
32
|
-
|
33
|
-
Rake::TestTask.new(:unit) do |test|
|
34
|
-
test.libs << 'lib' << 'test'
|
35
|
-
test.pattern = 'test/unit/**/test_*.rb'
|
36
|
-
test.verbose = true
|
37
|
-
end
|
38
|
-
|
39
|
-
Rake::TestTask.new(:integration) do |test|
|
40
|
-
test.libs << 'lib' << 'test'
|
41
|
-
test.pattern = 'test/integration/**/test_*.rb'
|
42
|
-
test.verbose = true
|
43
|
-
end
|
44
|
-
|
45
|
-
Rcov::RcovTask.new do |test|
|
46
|
-
test.libs << 'test'
|
47
|
-
test.pattern = 'test/**/test_*.rb'
|
48
|
-
test.verbose = true
|
49
|
-
test.rcov_opts << '--exclude "gems/*"'
|
50
|
-
end
|
51
|
-
|
52
|
-
desc "Run Unit & Integration Tests"
|
53
|
-
task :all => [:unit, :integration]
|
54
|
-
end
|
55
|
-
|
56
|
-
task :default => "test:all"
|
57
|
-
|
58
|
-
require 'yard'
|
59
|
-
YARD::Rake::YardocTask.new
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.0.2
|
data/stackmob.gemspec
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{stackmob}
|
8
|
-
s.version = "0.0.2"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [%q{StackMob}]
|
12
|
-
s.date = %q{2011-09-12}
|
13
|
-
s.description = %q{Support Gem for StackMob Heroku Add-On}
|
14
|
-
s.email = %q{jordan@stackmob.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE.txt",
|
17
|
-
"README.md"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
"Gemfile",
|
22
|
-
"Gemfile.lock",
|
23
|
-
"LICENSE.txt",
|
24
|
-
"README.md",
|
25
|
-
"Rakefile",
|
26
|
-
"VERSION",
|
27
|
-
"lib/stackmob.rb",
|
28
|
-
"lib/stackmob/client.rb",
|
29
|
-
"lib/stackmob/data_store.rb",
|
30
|
-
"lib/stackmob/deployer.rb",
|
31
|
-
"lib/stackmob/helpers.rb",
|
32
|
-
"lib/stackmob/push.rb",
|
33
|
-
"lib/stackmob/rack/simple_oauth_provider.rb",
|
34
|
-
"lib/stackmob/rails.rb",
|
35
|
-
"lib/stackmob/railtie.rb",
|
36
|
-
"lib/stackmob/sinatra.rb",
|
37
|
-
"lib/stackmob/tasks.rb",
|
38
|
-
"stackmob.gemspec",
|
39
|
-
"test/helper.rb",
|
40
|
-
"test/integration/test_client.rb",
|
41
|
-
"test/integration/test_data_store.rb",
|
42
|
-
"test/integration/test_deployer.rb",
|
43
|
-
"test/integration/test_push.rb",
|
44
|
-
"test/integration_helper.rb",
|
45
|
-
"test/unit/stackmob/rack/test_simple_oauth_provider.rb",
|
46
|
-
"test/unit/stackmob/test_client.rb",
|
47
|
-
"test/unit/stackmob/test_data_store.rb",
|
48
|
-
"test/unit/stackmob/test_deployer.rb",
|
49
|
-
"test/unit/stackmob/test_push.rb",
|
50
|
-
"test/unit/test_stackmob.rb"
|
51
|
-
]
|
52
|
-
s.homepage = %q{http://github.com/stackmob/stackmob-ruby}
|
53
|
-
s.licenses = [%q{MIT}]
|
54
|
-
s.require_paths = [%q{lib}]
|
55
|
-
s.rubygems_version = %q{1.8.6}
|
56
|
-
s.summary = %q{Support Gem for StackMob Heroku Add-On}
|
57
|
-
|
58
|
-
if s.respond_to? :specification_version then
|
59
|
-
s.specification_version = 3
|
60
|
-
|
61
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
62
|
-
s.add_runtime_dependency(%q<oauth>, ["~> 0.4.5"])
|
63
|
-
s.add_runtime_dependency(%q<yajl-ruby>, ["~> 0.8.2"])
|
64
|
-
s.add_development_dependency(%q<minitest>, [">= 0"])
|
65
|
-
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
66
|
-
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
67
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
68
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
69
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
70
|
-
s.add_development_dependency(%q<mocha>, [">= 0"])
|
71
|
-
s.add_development_dependency(%q<rack-test>, [">= 0"])
|
72
|
-
s.add_development_dependency(%q<bluecloth>, [">= 0"])
|
73
|
-
else
|
74
|
-
s.add_dependency(%q<oauth>, ["~> 0.4.5"])
|
75
|
-
s.add_dependency(%q<yajl-ruby>, ["~> 0.8.2"])
|
76
|
-
s.add_dependency(%q<minitest>, [">= 0"])
|
77
|
-
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
78
|
-
s.add_dependency(%q<cucumber>, [">= 0"])
|
79
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
80
|
-
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
81
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
82
|
-
s.add_dependency(%q<mocha>, [">= 0"])
|
83
|
-
s.add_dependency(%q<rack-test>, [">= 0"])
|
84
|
-
s.add_dependency(%q<bluecloth>, [">= 0"])
|
85
|
-
end
|
86
|
-
else
|
87
|
-
s.add_dependency(%q<oauth>, ["~> 0.4.5"])
|
88
|
-
s.add_dependency(%q<yajl-ruby>, ["~> 0.8.2"])
|
89
|
-
s.add_dependency(%q<minitest>, [">= 0"])
|
90
|
-
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
91
|
-
s.add_dependency(%q<cucumber>, [">= 0"])
|
92
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
93
|
-
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
94
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
95
|
-
s.add_dependency(%q<mocha>, [">= 0"])
|
96
|
-
s.add_dependency(%q<rack-test>, [">= 0"])
|
97
|
-
s.add_dependency(%q<bluecloth>, [">= 0"])
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
data/test/helper.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'minitest/unit'
|
11
|
-
require 'mocha'
|
12
|
-
require 'yajl'
|
13
|
-
|
14
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
16
|
-
require 'stackmob'
|
17
|
-
require 'stackmob/deployer' # include deployer explicitly for testing purposes since its not required by default
|
18
|
-
|
19
|
-
class MiniTest::Unit::TestCase
|
20
|
-
end
|
21
|
-
|
22
|
-
MiniTest::Unit.autorun
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'integration_helper'
|
2
|
-
|
3
|
-
# this test suite assumes that the Sandbox API
|
4
|
-
# deployed at ENV['STACKMOB_TEST_URL'] has an object
|
5
|
-
# model created of type "user", with a single string field
|
6
|
-
# "name". The application name must be "test"
|
7
|
-
|
8
|
-
class ClientIntegrationTest < StackMobIntegrationTest
|
9
|
-
|
10
|
-
def setup
|
11
|
-
super
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_valid_get_path
|
15
|
-
api_result_hash = valid_client.request(:get, :api, "/listapi")
|
16
|
-
assert api_result_hash.has_key?("user")
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_get_path_without_prepending_slash
|
20
|
-
res = valid_client.request(:get, :api, "listapi")
|
21
|
-
assert res.has_key?("user")
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_invalid_get_path_raises_error
|
25
|
-
assert_raises StackMob::Client::RequestError do
|
26
|
-
valid_client.request(:get, :api, "/dne")
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_user_object_lifecycle
|
31
|
-
username = "123"
|
32
|
-
name = "StackMob Test"
|
33
|
-
|
34
|
-
valid_client.request(:delete, :api, "/user", :username => username) # delete the object in case it exists already
|
35
|
-
|
36
|
-
valid_client.request(:post, :api, "/user", :username => username, :name => name)
|
37
|
-
|
38
|
-
assert_equal name, valid_client.request(:get, :api, "/user", :username => username).first['name']
|
39
|
-
|
40
|
-
valid_client.request(:put, :api, "/user", :username => username, :name => name + "updated")
|
41
|
-
|
42
|
-
assert_equal (name + "updated"), valid_client.request(:get, :api, "/user", :username => username).first['name']
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'integration_helper'
|
2
|
-
|
3
|
-
class DataStoreIntegrationTest < StackMobIntegrationTest
|
4
|
-
|
5
|
-
def setup
|
6
|
-
super
|
7
|
-
|
8
|
-
@ds = StackMob::DataStore.new(valid_client)
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_list_api
|
12
|
-
assert @ds.api_schema.has_key? "user"
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_user_object_lifecycle
|
16
|
-
username = "456"
|
17
|
-
name = "StackMob Test"
|
18
|
-
updated_name = "updated name"
|
19
|
-
|
20
|
-
@ds.delete(:user, :username => username)
|
21
|
-
|
22
|
-
@ds.create(:user, :username => username, :name => name)
|
23
|
-
|
24
|
-
assert_equal name, @ds.get(:user, :username => username).first['name']
|
25
|
-
|
26
|
-
@ds.update(:user, username, :name => updated_name)
|
27
|
-
|
28
|
-
assert_equal updated_name, @ds.get_one(:user, :username => username)['name']
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'integration_helper'
|
2
|
-
|
3
|
-
class DeployerIntegrationTest < StackMobIntegrationTest
|
4
|
-
|
5
|
-
def setup
|
6
|
-
super
|
7
|
-
|
8
|
-
@deployer = StackMob::Deployer.new(valid_client)
|
9
|
-
@hostname1 = "test.localhost"
|
10
|
-
@hostname2 = "test.localhost.2"
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_register_and_fetch_app
|
14
|
-
@deployer.register(@hostname1)
|
15
|
-
|
16
|
-
assert_equal @hostname1, @deployer.fetch['hostname']
|
17
|
-
|
18
|
-
@deployer.register(@hostname2)
|
19
|
-
|
20
|
-
assert_equal @hostname2, @deployer.fetch['hostname']
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'integration_helper'
|
2
|
-
|
3
|
-
class PushIntegrationTest < StackMobIntegrationTest
|
4
|
-
|
5
|
-
def setup
|
6
|
-
super
|
7
|
-
|
8
|
-
@user_id = "push_user"
|
9
|
-
@device_token = "1b9cc1e947889c47f83bab981f0b5349a38903578c40cca519b1c22796c5eadf"
|
10
|
-
|
11
|
-
@push = StackMob::Push.new(valid_client)
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_register_broadcast_push
|
15
|
-
@push.register(@user_id, @device_token)
|
16
|
-
|
17
|
-
@push.broadcast(:badge => 1, :sound => "audiofile.mpg", :alert => "My Push Message to all")
|
18
|
-
|
19
|
-
@push.send_message(@user_id, :sound => "anotherfile.mpg", :alert => "Ruby Gem Says: hi #{@user_id}", :badge => 2, :recipients_are_users => true)
|
20
|
-
|
21
|
-
@push.send_message(@device_token, :alert => "Ruby Gem: This is a message for token: #{@device_token}")
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
data/test/integration_helper.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class StackMobIntegrationTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
attr_reader :sm_url, :sm_key, :sm_secret, :valid_client
|
6
|
-
|
7
|
-
MISSING_URL_ERR_MSG = "!! ABORTED: You must define the STACKMOB_TEST_URL environment variable in order to run this suite"
|
8
|
-
|
9
|
-
def sm_app_vsn
|
10
|
-
0
|
11
|
-
end
|
12
|
-
|
13
|
-
def sm_app_name
|
14
|
-
"ruby_test"
|
15
|
-
end
|
16
|
-
|
17
|
-
def setup
|
18
|
-
set_sm_url!
|
19
|
-
set_sm_consumer_key
|
20
|
-
set_sm_consumer_secret
|
21
|
-
|
22
|
-
@valid_client = StackMob::Client.new(sm_url, sm_app_name, sm_app_vsn, sm_key, sm_secret)
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def set_sm_url!
|
28
|
-
if !(@sm_url = ENV['STACKMOB_TEST_URL']) then
|
29
|
-
puts MISSING_URL_ERR_MSG
|
30
|
-
exit
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
# SHOULD WE FORCE THESE TO BE ENVIRONMENT VARIABLES AS WELL?
|
35
|
-
# IT WOULD PREVENT THIS SUITE FROM BEING RUN WITH MOST LIKELY
|
36
|
-
# BAD CREDENTIALS, BUT WONT PREVENT IT ALTOGETHER
|
37
|
-
def set_sm_consumer_key
|
38
|
-
@sm_key = ENV['STACKMOB_TEST_KEY'] || "b0b4b19e-2901-4b3b-b8a7-67338d2b5cb3"
|
39
|
-
end
|
40
|
-
|
41
|
-
def set_sm_consumer_secret
|
42
|
-
@sm_secret = ENV['STACKMOB_TEST_SECRET'] || "b3764a11-cdcb-4750-9aad-cee0b6201d0c"
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
require 'rack/test'
|
3
|
-
|
4
|
-
class DummyApp
|
5
|
-
def call(env)
|
6
|
-
[200, {}, ""]
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
class SimpleOAuthProviderTest < MiniTest::Unit::TestCase
|
11
|
-
include Rack::Test::Methods
|
12
|
-
|
13
|
-
def app
|
14
|
-
StackMob::Rack::SimpleOAuthProvider.new(DummyApp.new)
|
15
|
-
end
|
16
|
-
|
17
|
-
def http_host
|
18
|
-
"jordan.panic.int.mob:3000"
|
19
|
-
end
|
20
|
-
|
21
|
-
def secret
|
22
|
-
"ebfe8b21-9401-421c-9b98-28bd721cf367"
|
23
|
-
end
|
24
|
-
|
25
|
-
def valid_oauth_header
|
26
|
-
"OAuth realm=\"\", oauth_signature=\"5JXBwMgL7yBrsDbxUCrfmidJ1gU%3D\", oauth_nonce=\"1312914650715662000\", oauth_signature_method=\"HMAC-SHA1\", oauth_consumer_key=\"655b062d-8c36-413d-ac0f-8354ca32c5ad\", oauth_timestamp=\"1312914650\""
|
27
|
-
end
|
28
|
-
|
29
|
-
def invalid_oauth_header
|
30
|
-
# this header has a slightly altered signature
|
31
|
-
"OAuth realm=\"\", oauth_signature=\"5XBwMgL7yBrsDbxUCrfmidJ1gU%3D\", oauth_nonce=\"1312914650715662000\", oauth_signature_method=\"HMAC-SHA1\", oauth_consumer_key=\"655b062d-8c36-413d-ac0f-8354ca32c5ad\", oauth_timestamp=\"1312914650\""
|
32
|
-
end
|
33
|
-
|
34
|
-
def setup
|
35
|
-
StackMob.stubs(:config).returns('development' => {}, 'production' => {})
|
36
|
-
StackMob.stubs(:secret).returns("ebfe8b21-9401-421c-9b98-28bd721cf367")
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_successful_oauth
|
40
|
-
get "/", {}, {"HTTP_AUTHORIZATION" => valid_oauth_header, "HTTP_HOST" => http_host}
|
41
|
-
|
42
|
-
assert last_response.ok?, "OAuth Failed When it Shouldn't Have"
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_failed_oauth
|
46
|
-
get "/", {}, {"HTTP_AUTHORIZATION" => invalid_oauth_header, "HTTP_HOST" => http_host}
|
47
|
-
|
48
|
-
assert !last_response.ok?, "OAuth Suceeded When it Shouldn't Have"
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
|