spaceship_stub 0.0.4 → 0.0.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2239c6bb6d04783fb3a1efec9f23407106b041f8
4
- data.tar.gz: daa09e43d3817d7635e6e16112bfb3be8d132934
3
+ metadata.gz: a0057b16c9ba962c1c1407345ba9809d13cad13a
4
+ data.tar.gz: 7d31c61c1d7966255c3470b9c738d24882fb0d03
5
5
  SHA512:
6
- metadata.gz: 443e6fc6c3a1e99fd283bc2d14a865047b3437ca20f046c1c9796698a7e382c30576bf5076d88cc9cff37b3da59b28fcea0ce444a5d037cfb73637b34370c773
7
- data.tar.gz: 452e7dbd14d011950faa65a1ff733413e2208ece08fad11c7137f408ffdfb52133f3c87a3f0d204b78abfced1fa08ea7e61509933f9fcbf1867f39a9e42466d6
6
+ metadata.gz: ea505979225772011d4d79442667c4ac5917a5ac08cbddbaf93e1377d1d8bbbc0eb0e53df8fd0b0845219f73f9c8a8d037dd10b807e61d8ca18b82266cc6336f
7
+ data.tar.gz: 3a075eeac085f74f219ed07c13f3fe54a20409d42774cf6ebab47fc21740386e6233fa623fb90dbb24bb76074f070e2fb9cd94c795cc22b0b966bf0d110b6dd4
@@ -0,0 +1,17 @@
1
+ class ClientStubbing
2
+ class << self
3
+ def client_read_fixture_file(filename)
4
+ File.read(File.join('spaceship', 'spec', 'fixtures', filename))
5
+ end
6
+
7
+ # Necessary, as we're now running this in a different context
8
+ def stub_request(*args)
9
+ WebMock::API.stub_request(*args)
10
+ end
11
+
12
+ def stub_connection_timeout_302
13
+ stub_request(:get, "http://example.com/").
14
+ to_return(status: 200, body: client_read_fixture_file('302.html'), headers: {})
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,63 @@
1
+ describe Spaceship::DUClient, :du do
2
+ before { Spaceship::Tunes.login }
3
+
4
+ let(:client) { Spaceship::AppVersion.client }
5
+ let(:app) { Spaceship::Application.all.first }
6
+ let(:contentProviderId) { "1234567" }
7
+ let(:ssoTokenForImage) { "sso token for image" }
8
+ let(:version) { app.edit_version }
9
+
10
+ subject { Spaceship::DUClient.new }
11
+
12
+ before do
13
+ allow(Spaceship::Utilities).to receive(:md5digest).and_return("FAKEMD5")
14
+ end
15
+
16
+ describe "#upload_large_icon and #upload_watch_icon" do
17
+ let(:correct_jpg_image) { du_uploadimage_correct_jpg }
18
+ let(:bad_png_image) { du_uploadimage_invalid_png }
19
+
20
+ it "handles successful upload request using #upload_large_icon" do
21
+ du_upload_large_image_success
22
+
23
+ data = subject.upload_large_icon(version, correct_jpg_image, contentProviderId, ssoTokenForImage)
24
+ expect(data['token']).to eq('Purple7/v4/65/04/4d/65044dae-15b0-a5e0-d021-5aa4162a03a3/pr_source.jpg')
25
+ end
26
+
27
+ it "handles failed upload request using #upload_watch_icon" do
28
+ du_upload_watch_image_failure
29
+
30
+ error_text = "[IMG_ALPHA_NOT_ALLOWED] Alpha is not allowed. Please edit the image to remove alpha and re-save it."
31
+ expect do
32
+ data = subject.upload_watch_icon(version, bad_png_image, contentProviderId, ssoTokenForImage)
33
+ end.to raise_error(Spaceship::Client::UnexpectedResponse, error_text)
34
+ end
35
+ end
36
+
37
+ describe "#upload_geojson" do
38
+ let(:valid_geojson) { du_upload_valid_geojson }
39
+ let(:invalid_geojson) { du_upload_invalid_geojson }
40
+
41
+ it "handles successful upload request" do
42
+ du_upload_geojson_success
43
+
44
+ data = subject.upload_geojson(version, valid_geojson, contentProviderId, ssoTokenForImage)
45
+ expect(data['token']).to eq('Purple1/v4/45/50/9d/45509d39-6a5d-7f55-f919-0fbc7436be61/pr_source.geojson')
46
+ expect(data['dsId']).to eq(1_206_675_732)
47
+ expect(data['type']).to eq('SMGameCenterAvatarImageType.SOURCE')
48
+ end
49
+
50
+ it "handles failed upload request" do
51
+ du_upload_geojson_failure
52
+
53
+ error_text = "[FILE_GEOJSON_FIELD_NOT_SUPPORTED] The routing app coverage file is in the wrong format. For more information, see the Location and Maps Programming Guide in the iOS Developer Library."
54
+ expect do
55
+ data = subject.upload_geojson(version, invalid_geojson, contentProviderId, ssoTokenForImage)
56
+ end.to raise_error(Spaceship::Client::UnexpectedResponse, error_text)
57
+ end
58
+ end
59
+
60
+ describe "#upload_screenshot" do
61
+ # we voluntary skip tests for this method, it's mostly covered by other functions
62
+ end
63
+ end
@@ -0,0 +1,158 @@
1
+ def du_fixture_file_path(filename)
2
+ File.join('spaceship', 'spec', 'du', 'fixtures', filename)
3
+ end
4
+
5
+ def du_read_fixture_file(filename)
6
+ File.read(du_fixture_file_path(filename))
7
+ end
8
+
9
+ # those represent UploadFile structures
10
+ def du_uploadimage_correct_screenshot
11
+ mock_jpg = double
12
+ allow(mock_jpg).to receive(:file_name).and_return('ftl_FAKEMD5_screenshot1024.jpg')
13
+ allow(mock_jpg).to receive(:file_size).and_return(1_234_520)
14
+ allow(mock_jpg).to receive(:content_type).and_return('image/jpeg')
15
+ allow(mock_jpg).to receive(:bytes).and_return("the screenshot...")
16
+ mock_jpg
17
+ end
18
+
19
+ def du_uploadimage_correct_jpg
20
+ mock_jpg = double
21
+ allow(mock_jpg).to receive(:file_name).and_return('ftl_FAKEMD5_icon1024.jpg')
22
+ allow(mock_jpg).to receive(:file_size).and_return(520)
23
+ allow(mock_jpg).to receive(:content_type).and_return('image/jpeg')
24
+ allow(mock_jpg).to receive(:bytes).and_return("binary image...")
25
+ mock_jpg
26
+ end
27
+
28
+ def du_uploadtrailer_correct_mov
29
+ mock_jpg = double
30
+ allow(mock_jpg).to receive(:file_name).and_return('ftl_FAKEMD5_trailer-en-US.mov')
31
+ allow(mock_jpg).to receive(:file_size).and_return(123_456)
32
+ allow(mock_jpg).to receive(:content_type).and_return('video/quicktime')
33
+ allow(mock_jpg).to receive(:bytes).and_return("binary video...")
34
+ mock_jpg
35
+ end
36
+
37
+ def du_uploadtrailer_preview_correct_jpg
38
+ mock_jpg = double
39
+ allow(mock_jpg).to receive(:file_name).and_return('ftl_FAKEMD5_trailer-en-US_preview.jpg')
40
+ allow(mock_jpg).to receive(:file_size).and_return(12_345)
41
+ allow(mock_jpg).to receive(:content_type).and_return('image/jpg')
42
+ allow(mock_jpg).to receive(:bytes).and_return("trailer preview...")
43
+ mock_jpg
44
+ end
45
+
46
+ def du_uploadimage_invalid_png
47
+ mock_jpg = double
48
+ allow(mock_jpg).to receive(:file_name).and_return('ftl_FAKEMD5_icon1024.jpg')
49
+ allow(mock_jpg).to receive(:file_size).and_return(520)
50
+ allow(mock_jpg).to receive(:content_type).and_return('image/png')
51
+ allow(mock_jpg).to receive(:bytes).and_return("invalid binary image...")
52
+ mock_jpg
53
+ end
54
+
55
+ def du_read_upload_geojson_response_success
56
+ du_read_fixture_file('upload_geojson_response_success.json')
57
+ end
58
+
59
+ def du_read_upload_geojson_response_failed
60
+ du_read_fixture_file('upload_geojson_response_failed.json')
61
+ end
62
+
63
+ def du_upload_valid_geojson
64
+ Spaceship::UploadFile.from_path(du_fixture_file_path('upload_valid.geojson'))
65
+ end
66
+
67
+ def du_upload_invalid_geojson
68
+ Spaceship::UploadFile.from_path(du_fixture_file_path('upload_invalid.GeoJSON'))
69
+ end
70
+
71
+ def du_read_upload_screenshot_response_success
72
+ du_read_fixture_file('upload_screenshot_response_success.json')
73
+ end
74
+
75
+ def du_read_upload_trailer_preview_response_success
76
+ du_read_fixture_file('upload_trailer_preview_response_success.json')
77
+ end
78
+
79
+ def du_read_upload_trailer_preview_2_response_success
80
+ du_read_fixture_file('upload_trailer_preview_2_response_success.json')
81
+ end
82
+
83
+ def du_upload_large_image_success
84
+ stub_request(:post, "https://du-itc.itunes.apple.com/upload/image").
85
+ with(body: "binary image...",
86
+ headers: { 'Accept' => 'application/json, text/plain, */*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Connection' => 'keep-alive', 'Content-Length' => '520', 'Content-Type' => 'image/jpeg', 'Referrer' => 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/898536088',
87
+ 'X-Apple-Jingle-Correlation-Key' => 'iOS App:AdamId=898536088:Version=0.9.13', 'X-Apple-Upload-Appleid' => '898536088', 'X-Apple-Upload-Contentproviderid' => '1234567', 'X-Apple-Upload-Itctoken' => 'sso token for image',
88
+ 'X-Apple-Upload-Referrer' => 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/898536088', 'X-Apple-Upload-Validation-Rulesets' => 'MZPFT.LargeApplicationIcon', 'X-Original-Filename' => 'ftl_FAKEMD5_icon1024.jpg' }).
89
+ to_return(status: 201, body: du_read_fixture_file('upload_image_success.json'), headers: { 'Content-Type' => 'application/json' })
90
+ end
91
+
92
+ def du_upload_watch_image_failure
93
+ stub_request(:post, "https://du-itc.itunes.apple.com/upload/image").
94
+ with(body: "invalid binary image...",
95
+ headers: { 'Accept' => 'application/json, text/plain, */*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Connection' => 'keep-alive', 'Content-Length' => '520', 'Content-Type' => 'image/png', 'Referrer' => 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/898536088',
96
+ 'X-Apple-Jingle-Correlation-Key' => 'iOS App:AdamId=898536088:Version=0.9.13', 'X-Apple-Upload-Appleid' => '898536088', 'X-Apple-Upload-Contentproviderid' => '1234567', 'X-Apple-Upload-Itctoken' => 'sso token for image',
97
+ 'X-Apple-Upload-Referrer' => 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/898536088', 'X-Apple-Upload-Validation-Rulesets' => 'MZPFT.GizmoAppIcon', 'X-Original-Filename' => 'ftl_FAKEMD5_icon1024.jpg' }).
98
+ to_return(status: 400, body: du_read_fixture_file('upload_image_failed.json'), headers: { 'Content-Type' => 'application/json' })
99
+ end
100
+
101
+ def du_upload_geojson_success
102
+ stub_request(:post, "https://du-itc.itunes.apple.com/upload/geo-json").
103
+ with(body: du_upload_valid_geojson.bytes,
104
+ headers: { 'Accept' => 'application/json, text/plain, */*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Connection' => 'keep-alive', 'Content-Length' => '224', 'Content-Type' => 'application/json', 'Referrer' => 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/898536088',
105
+ 'X-Apple-Jingle-Correlation-Key' => 'iOS App:AdamId=898536088:Version=0.9.13', 'X-Apple-Upload-Appleid' => '898536088', 'X-Apple-Upload-Contentproviderid' => '1234567', 'X-Apple-Upload-Itctoken' => 'sso token for image',
106
+ 'X-Apple-Upload-Referrer' => 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/898536088', 'X-Original-Filename' => 'ftl_FAKEMD5_upload_valid.geojson' }).
107
+ to_return(status: 201, body: du_read_upload_geojson_response_success, headers: { 'Content-Type' => 'application/json' })
108
+ end
109
+
110
+ def du_upload_geojson_failure
111
+ stub_request(:post, "https://du-itc.itunes.apple.com/upload/geo-json").
112
+ with(body: du_upload_invalid_geojson.bytes,
113
+ headers: { 'Accept' => 'application/json, text/plain, */*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Connection' => 'keep-alive', 'Content-Length' => '243', 'Content-Type' => 'application/json', 'Referrer' => 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/898536088',
114
+ 'X-Apple-Jingle-Correlation-Key' => 'iOS App:AdamId=898536088:Version=0.9.13', 'X-Apple-Upload-Appleid' => '898536088', 'X-Apple-Upload-Contentproviderid' => '1234567', 'X-Apple-Upload-Itctoken' => 'sso token for image',
115
+ 'X-Apple-Upload-Referrer' => 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/898536088', 'X-Original-Filename' => 'ftl_FAKEMD5_upload_invalid.GeoJSON' }).
116
+ to_return(status: 400, body: du_read_upload_geojson_response_failed, headers: { 'Content-Type' => 'application/json' })
117
+ end
118
+
119
+ def du_upload_screenshot_success
120
+ stub_request(:post, "https://du-itc.itunes.apple.com/upload/image").
121
+ with(body: "the screenshot...",
122
+ headers: { 'Accept' => 'application/json, text/plain, */*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Connection' => 'keep-alive', 'Content-Length' => '1234520', 'Content-Type' => 'image/jpeg', 'Referrer' => 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/898536088',
123
+ 'X-Apple-Jingle-Correlation-Key' => 'iOS App:AdamId=898536088:Version=0.9.13', 'X-Apple-Upload-Appleid' => '898536088', 'X-Apple-Upload-Contentproviderid' => '1234567', 'X-Apple-Upload-Itctoken' => 'the_sso_token_for_image',
124
+ 'X-Apple-Upload-Referrer' => 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/898536088', 'X-Apple-Upload-Validation-Rulesets' => 'MZPFT.SortedN41ScreenShot', 'X-Original-Filename' => 'ftl_FAKEMD5_screenshot1024.jpg' }).
125
+ to_return(status: 201, body: du_read_upload_screenshot_response_success, headers: { 'Content-Type' => 'application/json' })
126
+
127
+ stub_request(:post, "https://du-itc.itunes.apple.com/upload/image").
128
+ with(body: "the screenshot...",
129
+ headers: { 'Accept' => 'application/json, text/plain, */*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Connection' => 'keep-alive', 'Content-Length' => '1234520', 'Content-Type' => 'image/jpeg', 'Referrer' => 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/898536088',
130
+ 'User-Agent' => "Spaceship #{Fastlane::VERSION}", 'X-Apple-Jingle-Correlation-Key' => 'iOS App:AdamId=898536088:Version=0.9.13', 'X-Apple-Upload-Appleid' => '898536088', 'X-Apple-Upload-Contentproviderid' => '1234567',
131
+ 'X-Apple-Upload-Itctoken' => 'the_sso_token_for_image', 'X-Apple-Upload-Referrer' => 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/898536088', 'X-Apple-Upload-Validation-Rulesets' => 'MZPFT.SortedScreenShot', 'X-Original-Filename' => 'ftl_FAKEMD5_screenshot1024.jpg' }).
132
+ to_return(status: 201, body: du_read_upload_screenshot_response_success, headers: { 'Content-Type' => 'application/json' })
133
+ end
134
+
135
+ def du_upload_messages_screenshot_success
136
+ stub_request(:post, "https://du-itc.itunes.apple.com/upload/image").
137
+ with(body: "the screenshot...",
138
+ headers: { 'Accept' => 'application/json, text/plain, */*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Connection' => 'keep-alive', 'Content-Length' => '1234520', 'Content-Type' => 'image/jpeg', 'Referrer' => 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/898536088',
139
+ 'X-Apple-Jingle-Correlation-Key' => 'iOS App:AdamId=898536088:Version=0.9.13', 'X-Apple-Upload-Appleid' => '898536088', 'X-Apple-Upload-Contentproviderid' => '1234567', 'X-Apple-Upload-Itctoken' => 'the_sso_token_for_image',
140
+ 'X-Apple-Upload-Referrer' => 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/898536088', 'X-Apple-Upload-Validation-Rulesets' => 'MZPFT.SortedN41MessagesScreenShot', 'X-Original-Filename' => 'ftl_FAKEMD5_screenshot1024.jpg' }).
141
+ to_return(status: 201, body: du_read_upload_screenshot_response_success, headers: { 'Content-Type' => 'application/json' })
142
+
143
+ stub_request(:post, "https://du-itc.itunes.apple.com/upload/image").
144
+ with(body: "the screenshot...",
145
+ headers: { 'Accept' => 'application/json, text/plain, */*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Connection' => 'keep-alive', 'Content-Length' => '1234520', 'Content-Type' => 'image/jpeg', 'Referrer' => 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/898536088',
146
+ 'User-Agent' => "Spaceship #{Fastlane::VERSION}", 'X-Apple-Jingle-Correlation-Key' => 'iOS App:AdamId=898536088:Version=0.9.13', 'X-Apple-Upload-Appleid' => '898536088', 'X-Apple-Upload-Contentproviderid' => '1234567',
147
+ 'X-Apple-Upload-Itctoken' => 'the_sso_token_for_image', 'X-Apple-Upload-Referrer' => 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/898536088', 'X-Apple-Upload-Validation-Rulesets' => 'MZPFT.SortedScreenShot', 'X-Original-Filename' => 'ftl_FAKEMD5_screenshot1024.jpg' }).
148
+ to_return(status: 201, body: du_read_upload_screenshot_response_success, headers: { 'Content-Type' => 'application/json' })
149
+ end
150
+
151
+ # def du_upload_video_preview_success
152
+ # stub_request(:post, "https://du-itc.itunes.apple.com/upload/app-screenshot-image").
153
+ # with(body: "trailer preview...",
154
+ # headers: {'Accept' => 'application/json, text/plain, */*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Connection' => 'keep-alive', 'Content-Length' => '12345', 'Content-Type' => 'image/joeg', 'Referrer' => 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/898536088',
155
+ # 'User-Agent' => 'spaceship', 'X-Apple-Jingle-Correlation-Key' => 'iOS App:AdamId=898536088:Version=0.9.13', 'X-Apple-Upload-Appleid' => '898536088', 'X-Apple-Upload-Contentproviderid' => '1234567', 'X-Apple-Upload-Itctoken' => 'the_sso_token_for_image',
156
+ # 'X-Apple-Upload-Referrer' => 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/898536088', 'X-Original-Filename' => 'ftl_FAKEMD5_trailer-en-US_preview.jpg'}).
157
+ # to_return(status: 201, body: du_read_upload_trailer_preview_response_success, headers: {'Content-Type' => 'application/json'})
158
+ # end
@@ -0,0 +1,7 @@
1
+ {
2
+ "statusCode" : 400,
3
+ "errorCodes" : [ "FILE_GEOJSON_FIELD_NOT_SUPPORTED" ],
4
+ "suggestionCode" : "TRANSIT_APP_FILE_INVALID_JSON",
5
+ "nonLocalizedMessage" : "The routing app coverage file is incorrectly formatted. Please refer to Apple's documentation.",
6
+ "localizedMessage" : "The routing app coverage file is in the wrong format. For more information, see the Location and Maps Programming Guide in the iOS Developer Library."
7
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "token" : "Purple1/v4/45/50/9d/45509d39-6a5d-7f55-f919-0fbc7436be61/pr_source.geojson",
3
+ "type" : "SMGameCenterAvatarImageType.SOURCE",
4
+ "dsId" : 1206675732
5
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "statusCode" : 400,
3
+ "errorCodes" : [ "IMG_ALPHA_NOT_ALLOWED" ],
4
+ "suggestionCode" : "IMG_RESAVE_NO_ALPHA",
5
+ "nonLocalizedMessage" : "Alpha is not allowed. Please edit the image to remove alpha and re-save it.",
6
+ "localizedMessage" : "Alpha is not allowed. Please edit the image to remove alpha and re-save it.",
7
+ "width" : 1024,
8
+ "height" : 1024
9
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "token": "Purple7/v4/65/04/4d/65044dae-15b0-a5e0-d021-5aa4162a03a3/pr_source.jpg",
3
+ "tokenType": "AssetToken",
4
+ "type": "MZLargeApplicationIconType.SOURCE",
5
+ "width": 1024,
6
+ "height": 1024,
7
+ "hasAlpha": false,
8
+ "dsId": 1206675732,
9
+ "length": 198508,
10
+ "md5": "d41d8cd98f00b204e9800998ecf8427e"
11
+ }
@@ -0,0 +1,2 @@
1
+ {"type":"MultiPolygon","coordinates":
2
+ [[45.56497960813695, -74.22161340332036],[45.823011917542566, -73.46767663574224],[45.47356846799377, -73.30562829589849],[45.34051720106048, -73.51299523925786],[45.56497960813695, -74.22161340332036]]}
@@ -0,0 +1,11 @@
1
+ {
2
+ "token" : "Purple69/v4/66/c9/26/66c9269c-779e-1d75-431b-a34c69fe86ad/pr_source.png",
3
+ "tokenType" : "AssetToken",
4
+ "type" : "MZSortedN41ScreenShotImageType.SOURCE",
5
+ "width" : 1136,
6
+ "height" : 640,
7
+ "hasAlpha" : false,
8
+ "dsId" : 1206675732,
9
+ "length" : 317323,
10
+ "md5" : "d41d8cd98f00b204e9800998ecf8427e"
11
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "token" : "Purple70/v4/5f/2b/81/5f2b814d-1083-5509-61fb-c0845f7a9374/pr_source.jpg",
3
+ "tokenType" : "AssetToken",
4
+ "type" : "MZSortedTabletScreenShotImageType.SOURCE",
5
+ "width" : 768,
6
+ "height" : 1024,
7
+ "hasAlpha" : false,
8
+ "dsId" : 1206675732,
9
+ "descriptionDoc" : "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><!--Generated by the FoghornLeghorn ImageDescriptionGenerator, version 1.24--><image><height>1024</height><width>768</width><sample_precision>8</sample_precision><color_space>RGB</color_space><alpha_channel>false</alpha_channel><color_map>false</color_map></image>",
10
+ "length" : 34803,
11
+ "md5" : "d41d8cd98f00b204e9800998ecf8427e"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "token" : "Purple69/v4/5f/2b/81/5f2b814d-1083-5509-61fb-c0845f7a9374/pr_source.jpg",
3
+ "tokenType" : "AssetToken",
4
+ "type" : "MZSortedTabletScreenShotImageType.SOURCE",
5
+ "width" : 768,
6
+ "height" : 1024,
7
+ "hasAlpha" : false,
8
+ "dsId" : 1206675732,
9
+ "descriptionDoc" : "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><!--Generated by the FoghornLeghorn ImageDescriptionGenerator, version 1.24--><image><height>1024</height><width>768</width><sample_precision>8</sample_precision><color_space>RGB</color_space><alpha_channel>false</alpha_channel><color_map>false</color_map></image>",
10
+ "length" : 34803,
11
+ "md5" : "d41d8cd98f00b204e9800998ecf8427e"
12
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "responses" : [ {
3
+ "url" : "http://a1846.phobos.apple.com/us/r30/VideoSource40/v4/e3/48/1a/e3481a8f-ec25-e19f-5048-270d7acaf89a/pr_source.mov?downloadKey=1438619697_55da9f1a93478be2a96468b3c4dda992",
4
+ "token" : "VideoSource40/v4/e3/48/1a/e3481a8f-ec25-e19f-5048-270d7acaf89a/pr_source.mov",
5
+ "groupToken" : {
6
+ "groupToken" : "VideoSource40/v4/e3/48/1a/e3481a8f-ec25-e19f-5048-270d7acaf89a",
7
+ "pool" : "VideoSource40",
8
+ "syntaxVersion" : "HASH_MOUNT_UUID_GROUP"
9
+ },
10
+ "blobString" : "{\"token\":\"VideoSource40/v4/e3/48/1a/e3481a8f-ec25-e19f-5048-270d7acaf89a/pr_source.mov\",\"type\":\"MZPurpleSoftwarePromoVideoFileType.SOURCE\",\"originalFileName\":\"preview dbn 5-900-note.mov\"}",
11
+ "descriptionDoc" : "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><!--Generated by the FoghornLeghorn Quicktime MediaDescriptionGenerator, version 1.24--><!--File URL: \"\"--><movie xmlns:ma=\"http://beans.media.leghorn.jingle.apple.com\" codecs=\"avc1.274D40, mp4a.40.2\" type=\"quicktime\"><describer><ma:name>FoghornLeghorn Quicktime Parser</ma:name><ma:version>1.24</ma:version></describer><clock poster_time=\"0\" preview_duration=\"0\" preview_time=\"0\" time_scale=\"600\" total_duration=\"18238\"/><tracks><video enabled=\"true\" index=\"0\" type=\"vide\"><track_id>1</track_id><language numeric=\"0\">eng</language><alternate_group>0</alternate_group><matrix identity=\"true\"/><data_size units=\"bytes\">7885386</data_size><duration milliseconds=\"30397\" track_duration=\"18238\" units=\"milliseconds\">30397</duration><edit_list count=\"1\" empties=\"0\" normal_rate=\"true\"><edit_list_entry media_rate=\"1.0\" media_time=\"0\" track_duration=\"18238\"/></edit_list><sample_description_count>1</sample_description_count><duration_statistics mean_duration=\"125.0\" time_scale=\"2997\" total_duration=\"91125\" uniform=\"true\"/><user_data_atoms/><data_rate units=\"Kb/s\">2026.6886</data_rate><data_rate_statistics units=\"Kb/s\"><peak first_media_DTS=\"81125\" last_media_DTS=\"81125\">4708</peak></data_rate_statistics><graphics_mode>dither_copy</graphics_mode><codec name=\"avc1\" type=\"avc1.274D40\">avc1</codec><encoded_dimensions><width>900</width><height>1200</height></encoded_dimensions><display_dimensions><width>900</width><height>1200</height></display_dimensions><track_dimensions><width>900</width><height>1200</height></track_dimensions><frame_rate>23.976</frame_rate><field_dominance>progressive</field_dominance><sample_description><colr><color_parameter_type>nclc</color_parameter_type><matrix_index>1</matrix_index><primaries_index>1</primaries_index><transfer_function_index>1</transfer_function_index></colr><avcC><profile>Main</profile><compatability>64</compatability><level>3.2</level><nal_units><picture_parameter_sets><pic_parameter_set entropy_coding_mode_flag=\"0\" pic_parameter_set_id=\"0\" seq_parameter_set_id=\"0\"/></picture_parameter_sets></nal_units><raw_avcc>014D4020FF010015274D4020A9181C812FCFE00D4040404C2B5EF7C04001000428DE09C8</raw_avcc></avcC></sample_description><maximum_sample_size>119642</maximum_sample_size></video><sound enabled=\"true\" index=\"1\" type=\"soun\"><track_id>2</track_id><language numeric=\"0\">eng</language><alternate_group>0</alternate_group><matrix identity=\"true\"/><data_size units=\"bytes\">469102</data_size><duration milliseconds=\"30187\" track_duration=\"18112\" units=\"milliseconds\">30187</duration><edit_list count=\"1\" empties=\"0\" normal_rate=\"true\"><edit_list_entry media_rate=\"1.0\" media_time=\"0\" track_duration=\"18112\"/></edit_list><sample_description_count>1</sample_description_count><user_data_atoms/><data_rate units=\"Kb/s\">122.16198</data_rate><data_rate_statistics units=\"Kb/s\"><peak first_media_DTS=\"231424\" last_media_DTS=\"231424\">199</peak></data_rate_statistics><codec name=\"aac \" type=\"mp4a.40.2\">aac </codec><channel_layout name=\"Stereo (L R)\"><channel name=\"Left\">L</channel><channel name=\"Right\">R</channel></channel_layout><sample_rate units=\"kilohertz\">48.0</sample_rate></sound></tracks><matrix identity=\"true\"/></movie>"
12
+ } ]
13
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "type": "MultiPolygon",
3
+ "coordinates": [
4
+ [[[-122.7, 37.3], [-121.9, 37.3], [-121.9, 37.9], [-122.7, 37.9], [-122.7, 37.3]]],
5
+ [[[-87.9, 41.5], [-87.3, 41.5], [-87.3, 42.1], [-87.9, 42.1], [-87.9, 41.5]]]
6
+ ]
7
+ }
@@ -0,0 +1,35 @@
1
+ describe Spaceship::Utilities do
2
+ describe '#content_type' do
3
+ it 'recognizes the .jpg extension' do
4
+ expect(Spaceship::Utilities.content_type('blah.jpg')).to eq('image/jpeg')
5
+ end
6
+
7
+ it 'recognizes the .jpeg extension' do
8
+ expect(Spaceship::Utilities.content_type('blah.jpeg')).to eq('image/jpeg')
9
+ end
10
+
11
+ it 'recognizes the .png extension' do
12
+ expect(Spaceship::Utilities.content_type('blah.png')).to eq('image/png')
13
+ end
14
+
15
+ it 'recognizes the .geojson extension' do
16
+ expect(Spaceship::Utilities.content_type('blah.geojson')).to eq('application/json')
17
+ end
18
+
19
+ it 'recognizes the .mov extension' do
20
+ expect(Spaceship::Utilities.content_type('blah.mov')).to eq('video/quicktime')
21
+ end
22
+
23
+ it 'recognizes the .m4v extension' do
24
+ expect(Spaceship::Utilities.content_type('blah.m4v')).to eq('video/mp4')
25
+ end
26
+
27
+ it 'recognizes the .mp4 extension' do
28
+ expect(Spaceship::Utilities.content_type('blah.mp4')).to eq('video/mp4')
29
+ end
30
+
31
+ it 'raises an exception for unknown extensions' do
32
+ expect { Spaceship::Utilities.content_type('blah.unknown') }.to raise_error "Unknown content-type for file blah.unknown"
33
+ end
34
+ end
35
+ end
@@ -1,7 +1,7 @@
1
- # require_relative 'client_stubbing'
2
- # require_relative 'portal/portal_stubbing'
3
- require_relative 'spaceship_stub/tunes_stubbing'
4
- # require_relative 'du/du_stubbing'
1
+ require_relative 'spaceship_stub/spec/client_stubbing'
2
+ require_relative 'spaceship_stub/spec/portal/portal_stubbing'
3
+ require_relative 'spaceship_stub/spec/tunes/tunes_stubbing'
4
+ require_relative 'spaceship_stub/spec/du/du_stubbing'
5
5
 
6
6
  module SpaceshipStub
7
7
  class << self
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spaceship_stub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minh Luong
@@ -17,6 +17,20 @@ extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
19
  - lib/spaceship_stub.rb
20
+ - lib/spaceship_stub/spaceship/spec/client_stubbing.rb
21
+ - lib/spaceship_stub/spaceship/spec/du/du_client_spec.rb
22
+ - lib/spaceship_stub/spaceship/spec/du/du_stubbing.rb
23
+ - lib/spaceship_stub/spaceship/spec/du/fixtures/upload_geojson_response_failed.json
24
+ - lib/spaceship_stub/spaceship/spec/du/fixtures/upload_geojson_response_success.json
25
+ - lib/spaceship_stub/spaceship/spec/du/fixtures/upload_image_failed.json
26
+ - lib/spaceship_stub/spaceship/spec/du/fixtures/upload_image_success.json
27
+ - lib/spaceship_stub/spaceship/spec/du/fixtures/upload_invalid.GeoJSON
28
+ - lib/spaceship_stub/spaceship/spec/du/fixtures/upload_screenshot_response_success.json
29
+ - lib/spaceship_stub/spaceship/spec/du/fixtures/upload_trailer_preview_2_response_success.json
30
+ - lib/spaceship_stub/spaceship/spec/du/fixtures/upload_trailer_preview_response_success.json
31
+ - lib/spaceship_stub/spaceship/spec/du/fixtures/upload_trailer_response_success.json
32
+ - lib/spaceship_stub/spaceship/spec/du/fixtures/upload_valid.geojson
33
+ - lib/spaceship_stub/spaceship/spec/du/utilities_spec.rb
20
34
  - lib/spaceship_stub/spaceship/spec/portal/app_group_spec.rb
21
35
  - lib/spaceship_stub/spaceship/spec/portal/app_spec.rb
22
36
  - lib/spaceship_stub/spaceship/spec/portal/certificate_spec.rb
@@ -161,7 +175,7 @@ files:
161
175
  - lib/spaceship_stub/spaceship/spec/tunes/fixtures/update_app_version_temporarily_unable.json
162
176
  - lib/spaceship_stub/spaceship/spec/tunes/fixtures/update_app_version_with_autorelease_overwrite_success.json
163
177
  - lib/spaceship_stub/spaceship/spec/tunes/fixtures/user_detail.json
164
- - lib/spaceship_stub/tunes_stubbing.rb
178
+ - lib/spaceship_stub/spaceship/spec/tunes/tunes_stubbing.rb
165
179
  homepage: https://github.com/luongm/spaceship_stub
166
180
  licenses:
167
181
  - MIT