itunes_validator 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/itunes_validator.gemspec +2 -2
- data/lib/itunes_validator.rb +1 -1
- data/test/test_itunes_validator.rb +45 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 723220c4d8ec1994c0e2f2cdc7ccdd2ac7a2e1d5
|
4
|
+
data.tar.gz: ad2bb0d8a6cd2cb6cccc130d1acae23dbc7d81c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 363a8c8239f61173794eb64bc8660212a4159d370cd13c79ec3f33a2a1ecf4a2856db27b899f15fbc4c504308e5af91bc963cddd40ce62cd9541537356e5d737
|
7
|
+
data.tar.gz: aae61512aecd1452d9479a6d77da8c4197ee23de60e15cceb866a83323d37c0d48e74f7ddd951379e2f12d74084f9a50332011633a0cdb7fdf9c2b2314ea720b
|
data/itunes_validator.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
|
14
14
|
meta_files = %w| LICENSE README.md Rakefile itunes_validator.gemspec |
|
15
15
|
lib_files = %w| lib/itunes_validator.rb lib/itunes_validator/client.rb lib/itunes_validator/receipt.rb |
|
16
|
-
test_files =
|
17
|
-
s.test_files = test_files.select{ |f| File.extname(f) == 'rb' }
|
16
|
+
test_files = %w| test/coverage.rb test/test_itunes_validator.rb |
|
17
|
+
s.test_files = test_files.select{ |f| File.extname(f) == 'rb' && File.basename(f).start_with?('test_') }
|
18
18
|
s.files = meta_files + lib_files + test_files
|
19
19
|
|
20
20
|
s.add_development_dependency 'rake'
|
data/lib/itunes_validator.rb
CHANGED
@@ -19,37 +19,71 @@ class TestItunesValidator < Test::Unit::TestCase
|
|
19
19
|
assert_not_nil(v)
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
22
|
+
def test_validation_noproxy_client
|
23
|
+
proxy = ENV['HTTPS_PROXY'] || ENV['https_proxy'] || ENV['HTTP_PROXY'] || ENV['http_proxy']
|
24
|
+
return if proxy
|
25
|
+
|
23
26
|
receipt_data=ENV['RECEIPT_DATA']
|
24
27
|
return unless receipt_data
|
25
28
|
|
26
29
|
v = ItunesValidator::Client.new()
|
27
30
|
r = v.validate(receipt_data)
|
28
31
|
assert_not_nil(r)
|
32
|
+
end
|
29
33
|
|
34
|
+
def test_validation_noproxy_convenience
|
30
35
|
proxy = ENV['HTTPS_PROXY'] || ENV['https_proxy'] || ENV['HTTP_PROXY'] || ENV['http_proxy']
|
31
|
-
if proxy
|
32
|
-
proxy_host, proxy_port = proxy.split(':')
|
33
|
-
assert_not_nil(proxy_host)
|
36
|
+
return if proxy
|
34
37
|
|
35
|
-
|
36
|
-
|
37
|
-
assert_not_nil(r)
|
38
|
+
receipt_data=ENV['RECEIPT_DATA']
|
39
|
+
return unless receipt_data
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
-
|
41
|
+
r = ItunesValidator.validate(receipt_data)
|
42
|
+
assert_not_nil(r)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_validation_proxy_client
|
46
|
+
proxy = ENV['HTTPS_PROXY'] || ENV['https_proxy'] || ENV['HTTP_PROXY'] || ENV['http_proxy']
|
47
|
+
return unless proxy
|
48
|
+
|
49
|
+
proxy_host, proxy_port = proxy.split(':')
|
50
|
+
assert_not_nil(proxy_host)
|
51
|
+
|
52
|
+
receipt_data=ENV['RECEIPT_DATA']
|
53
|
+
return unless receipt_data
|
54
|
+
|
55
|
+
v = ItunesValidator::Client.new({proxy_host: proxy_host, proxy_port: proxy_port})
|
56
|
+
r = v.validate(receipt_data)
|
57
|
+
assert_not_nil(r)
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_validation_proxy_convenience
|
61
|
+
proxy = ENV['HTTPS_PROXY'] || ENV['https_proxy'] || ENV['HTTP_PROXY'] || ENV['http_proxy']
|
62
|
+
return unless proxy
|
63
|
+
|
64
|
+
proxy_host, proxy_port = proxy.split(':')
|
65
|
+
assert_not_nil(proxy_host)
|
66
|
+
|
67
|
+
receipt_data=ENV['RECEIPT_DATA']
|
68
|
+
return unless receipt_data
|
69
|
+
|
70
|
+
r = ItunesValidator.validate({proxy_host: proxy_host, proxy_port: proxy_port}, receipt_data)
|
71
|
+
assert_not_nil(r)
|
42
72
|
end
|
43
73
|
|
44
|
-
def
|
74
|
+
def test_invalid_parameters_missing_options
|
45
75
|
assert_raises(ArgumentError) do
|
46
76
|
ItunesValidator.validate
|
47
77
|
end
|
78
|
+
end
|
48
79
|
|
80
|
+
def test_invalid_parameters_nil_options
|
49
81
|
assert_raises(ItunesValidator::ParameterError) do
|
50
82
|
ItunesValidator.validate(nil)
|
51
83
|
end
|
84
|
+
end
|
52
85
|
|
86
|
+
def test_invalid_parameters_no_receipt
|
53
87
|
assert_raises(ItunesValidator::ParameterError) do
|
54
88
|
ItunesValidator.validate({shared_secret: 'secret'}, nil)
|
55
89
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itunes_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Talbot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|