spaceship_stub 0.0.3 → 0.0.4

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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/lib/spaceship_stub/spaceship/spec/portal/app_group_spec.rb +57 -0
  3. data/lib/spaceship_stub/spaceship/spec/portal/app_spec.rb +136 -0
  4. data/lib/spaceship_stub/spaceship/spec/portal/certificate_spec.rb +116 -0
  5. data/lib/spaceship_stub/spaceship/spec/portal/device_spec.rb +142 -0
  6. data/lib/spaceship_stub/spaceship/spec/portal/enterprise_spec.rb +28 -0
  7. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/addAppId.action.apostroph.json +51 -0
  8. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/addAppId.action.explicit.json +51 -0
  9. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/addAppId.action.nopush.json +50 -0
  10. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/addAppId.action.wildcard.json +49 -0
  11. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/addApplicationGroup.action.json +22 -0
  12. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/addDeviceResponse.action.json +30 -0
  13. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/addDeviceResponse.action.plist +33 -0
  14. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/addWebsitePushId.action.json +22 -0
  15. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/aps_development.cer +0 -0
  16. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/certificateCreate.certRequest.json +44 -0
  17. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/certificateSigningRequest.certSigningRequest +16 -0
  18. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/create_profile_name_taken.txt +1 -0
  19. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/create_profile_success.json +64 -0
  20. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/deleteAppId.action.json +16 -0
  21. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/deleteApplicationGroup.action.json +16 -0
  22. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/deleteDevice.action.json +13 -0
  23. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/deleteProvisioningProfile.action.json +16 -0
  24. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/deleteWebsitePushId.action.json +16 -0
  25. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/dev_center_provisioning_profiles_response.json +829 -0
  26. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/download_certificate_failure.html +13 -0
  27. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/downloaded_provisioning_profile.mobileprovision +51 -0
  28. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/enableDevice.action.json +22 -0
  29. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/getAppIdDetail.action.json +55 -0
  30. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/getProvisioningProfileAdHoc.action.json +108 -0
  31. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/getProvisioningProfileAppStore.action.json +91 -0
  32. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/getProvisioningProfileDevelopment.action.json +108 -0
  33. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/getProvisioningProfiletvOSAppStore.action.json +93 -0
  34. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listApplicationGroups.action.json +30 -0
  35. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listApps.action.json +97 -0
  36. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listAppsMac.action.json +97 -0
  37. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listCertRequests.action.json +80 -0
  38. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevices.action.json +53 -0
  39. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesDisabled.action.json +71 -0
  40. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesPage1-2.action.json +65 -0
  41. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesPage2-2.action.json +23 -0
  42. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesTV.action.json +26 -0
  43. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesWatch.action.json +26 -0
  44. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesiPhone.action.json +44 -0
  45. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesiPod.action.json +26 -0
  46. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listProvisioningProfiles.action.json +126 -0
  47. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listProvisioningProfiles.action.plist +597 -0
  48. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listTeams.action.json +61 -0
  49. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listTeams_multiple.action.json +105 -0
  50. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listWebsitePushIds.action.json +31 -0
  51. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/list_certificates_filtered.json +38 -0
  52. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/peopleList.json +34 -0
  53. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/profileContentDownload.action +0 -0
  54. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/repair_profile_success.json +65 -0
  55. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/repair_profile_tvos_success.json +66 -0
  56. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/revokeCertificate.action.json +56 -0
  57. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/submitCertificateRequest.action.json +59 -0
  58. data/lib/spaceship_stub/spaceship/spec/portal/fixtures/updateAppIdName.action.json +44 -0
  59. data/lib/spaceship_stub/spaceship/spec/portal/person_spec.rb +27 -0
  60. data/lib/spaceship_stub/spaceship/spec/portal/persons_spec.rb +19 -0
  61. data/lib/spaceship_stub/spaceship/spec/portal/portal_client_spec.rb +279 -0
  62. data/lib/spaceship_stub/spaceship/spec/portal/portal_permission_spec.rb +26 -0
  63. data/lib/spaceship_stub/spaceship/spec/portal/portal_stubbing.rb +293 -0
  64. data/lib/spaceship_stub/spaceship/spec/portal/tvos_profile_spec.rb +24 -0
  65. data/lib/spaceship_stub/spaceship/spec/portal/website_push_spec.rb +57 -0
  66. metadata +65 -1
@@ -0,0 +1,293 @@
1
+ class PortalStubbing
2
+ class << self
3
+ def adp_read_fixture_file(filename)
4
+ File.read(File.join('spaceship', 'spec', 'portal', '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
+ # Optional: enterprise
13
+ def adp_enterprise_stubbing
14
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/certificate/listCertRequests.action").
15
+ with(body: { "pageNumber" => "1", "pageSize" => "500", "sort" => "certRequestStatusCode=asc", "teamId" => "XXXXXXXXXX", "types" => "9RQEK7MSXA" }).
16
+ to_return(status: 200, body: adp_read_fixture_file(File.join("enterprise", "listCertRequests.action.json")), headers: { 'Content-Type' => 'application/json' })
17
+
18
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/profile/createProvisioningProfile.action").
19
+ with(body: { "appIdId" => "2UMR2S6PAA", "certificateIds" => "Q82WC5JRE9", "distributionType" => "inhouse", "provisioningProfileName" => "Delete Me", "teamId" => "XXXXXXXXXX" }).
20
+ to_return(status: 200, body: adp_read_fixture_file('create_profile_success.json'), headers: { 'Content-Type' => 'application/json' })
21
+ end
22
+
23
+ # Optional: Team Selection
24
+ def adp_stub_multiple_teams
25
+ stub_request(:post, 'https://developer.apple.com/services-account/QH65B2/account/listTeams.action').
26
+ to_return(status: 200, body: adp_read_fixture_file('listTeams_multiple.action.json'), headers: { 'Content-Type' => 'application/json' })
27
+ end
28
+
29
+ def adp_stub_login
30
+ # Most stuff is stubbed in tunes_stubbing (since it's shared)
31
+ stub_request(:post, 'https://developer.apple.com/services-account/QH65B2/account/listTeams.action').
32
+ to_return(status: 200, body: adp_read_fixture_file('listTeams.action.json'), headers: { 'Content-Type' => 'application/json' })
33
+ end
34
+
35
+ def adp_stub_provisioning
36
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/profile/listProvisioningProfiles.action").
37
+ to_return(status: 200, body: adp_read_fixture_file('listProvisioningProfiles.action.json'), headers: { 'Content-Type' => 'application/json' })
38
+
39
+ stub_request(:post, "https://developerservices2.apple.com/services/QH65B2/ios/listProvisioningProfiles.action?includeInactiveProfiles=true&onlyCountLists=true&teamId=XXXXXXXXXX").
40
+ to_return(status: 200, body: adp_read_fixture_file('listProvisioningProfiles.action.plist'), headers: { 'Content-Type' => 'text/x-xml-plist' })
41
+
42
+ stub_request(:get, "https://developer.apple.com/services-account/QH65B2/account/ios/profile/downloadProfileContent?provisioningProfileId=PP00000001&teamId=XXXXXXXXXX").
43
+ to_return(status: 200, body: adp_read_fixture_file("downloaded_provisioning_profile.mobileprovision"), headers: {})
44
+
45
+ # Download profiles
46
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action").
47
+ with(body: { "provisioningProfileId" => "PP00000001", "teamId" => "XXXXXXXXXX" }).
48
+ to_return(status: 200, body: adp_read_fixture_file('getProvisioningProfileAdHoc.action.json'), headers: { 'Content-Type' => 'application/json' })
49
+
50
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action").
51
+ with(body: { "provisioningProfileId" => "PP00000006", "teamId" => "XXXXXXXXXX" }).
52
+ to_return(status: 200, body: adp_read_fixture_file('getProvisioningProfileAppStore.action.json'), headers: { 'Content-Type' => 'application/json' })
53
+
54
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action").
55
+ with(body: { "provisioningProfileId" => "PP00000002", "teamId" => "XXXXXXXXXX" }).
56
+ to_return(status: 200, body: adp_read_fixture_file('getProvisioningProfileAppStore.action.json'), headers: { 'Content-Type' => 'application/json' })
57
+
58
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action").
59
+ with(body: { "provisioningProfileId" => "PP00000003", "teamId" => "XXXXXXXXXX" }).
60
+ to_return(status: 200, body: adp_read_fixture_file('getProvisioningProfileAppStore.action.json'), headers: { 'Content-Type' => 'application/json' })
61
+
62
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action").
63
+ with(body: { "provisioningProfileId" => "PP00000004", "teamId" => "XXXXXXXXXX" }).
64
+ to_return(status: 200, body: adp_read_fixture_file('getProvisioningProfileAppStore.action.json'), headers: { 'Content-Type' => 'application/json' })
65
+
66
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action").
67
+ with(body: { "provisioningProfileId" => "2MAY7NPHRU", "teamId" => "XXXXXXXXXX" }).
68
+ to_return(status: 200, body: adp_read_fixture_file('getProvisioningProfileAppStore.action.json'), headers: { 'Content-Type' => 'application/json' })
69
+
70
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action").
71
+ with(body: { "provisioningProfileId" => "2MAY7NPHRF", "teamId" => "XXXXXXXXXX" }).
72
+ to_return(status: 200, body: adp_read_fixture_file('getProvisioningProfiletvOSAppStore.action.json'), headers: { 'Content-Type' => 'application/json' })
73
+
74
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action").
75
+ with(body: { "provisioningProfileId" => "PP00000005", "teamId" => "XXXXXXXXXX" }).
76
+ to_return(status: 200, body: adp_read_fixture_file('getProvisioningProfileDevelopment.action.json'), headers: { 'Content-Type' => 'application/json' })
77
+
78
+ # Create Profiles
79
+
80
+ # Name is free
81
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/profile/createProvisioningProfile.action").
82
+ with(body: { "appIdId" => "R9YNDTPLJX", "certificateIds" => "C8DL7464RQ", "deviceIds" => "C8DLAAAARQ", "distributionType" => "limited", "provisioningProfileName" => "net.sunapps.106 limited", "teamId" => "XXXXXXXXXX" }).
83
+ to_return(status: 200, body: adp_read_fixture_file('create_profile_success.json'), headers: { 'Content-Type' => 'application/json' })
84
+
85
+ # Name already taken
86
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/profile/createProvisioningProfile.action").
87
+ with(body: { "appIdId" => "R9YNDTPLJX", "certificateIds" => "C8DL7464RQ", "deviceIds" => "C8DLAAAARQ", "distributionType" => "limited", "provisioningProfileName" => "taken", "teamId" => "XXXXXXXXXX" }).
88
+ to_return(status: 200, body: adp_read_fixture_file("create_profile_name_taken.txt"))
89
+
90
+ # Repair Profiles
91
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/profile/regenProvisioningProfile.action").
92
+ with(body: { "appIdId" => "572XTN75U2", "certificateIds" => "XC5PH8D47H", "deviceIds" => ["AAAAAAAAAA", "BBBBBBBBBB", "CCCCCCCCCC", "DDDDDDDDDD"], "distributionType" => "store", "provisioningProfileName" => "net.sunapps.7 AppStore", "teamId" => "XXXXXXXXXX" }).
93
+ to_return(status: 200, body: adp_read_fixture_file('repair_profile_success.json'), headers: { 'Content-Type' => 'application/json' })
94
+
95
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/profile/regenProvisioningProfile.action").
96
+ with(body: { "appIdId" => "572XTN75U2", "certificateIds" => "XC5PH8D47H", "deviceIds" => ["AAAAAAAAAA", "BBBBBBBBBB", "CCCCCCCCCC", "DDDDDDDDDD"], "distributionType" => "store", "provisioningProfileName" => "net.sunapps.7 AppStore", "teamId" => "XXXXXXXXXX", "subPlatform" => "tvOS" }).
97
+ to_return(status: 200, body: adp_read_fixture_file('repair_profile_tvos_success.json'), headers: { 'Content-Type' => 'application/json' })
98
+
99
+ # Delete Profiles
100
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/profile/deleteProvisioningProfile.action").
101
+ with(body: { "provisioningProfileId" => "2MAY7NPHRU", "teamId" => "XXXXXXXXXX" }).
102
+ to_return(status: 200, body: adp_read_fixture_file('deleteProvisioningProfile.action.json'), headers: { 'Content-Type' => 'application/json' })
103
+
104
+ # tvOS Profiles
105
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/profile/createProvisioningProfile.action").
106
+ with(body: { "appIdId" => "2UMR2S6PAA", "certificateIds" => "C8DL7464RQ", "deviceIds" => "EEEEEEEEEE", "distributionType" => "limited", "provisioningProfileName" => "Delete Me", "subPlatform" => "tvOS", "teamId" => "XXXXXXXXXX" }).
107
+ to_return(status: 200, body: adp_read_fixture_file('create_profile_success.json'), headers: { 'Content-Type' => 'application/json' })
108
+ end
109
+
110
+ def adp_stub_devices
111
+ stub_request(:post, 'https://developer.apple.com/services-account/QH65B2/account/ios/device/listDevices.action').
112
+ with(body: { deviceClasses: 'iphone', teamId: 'XXXXXXXXXX', pageSize: "500", pageNumber: "1", sort: 'name=asc', includeRemovedDevices: "false" }).
113
+ to_return(status: 200, body: adp_read_fixture_file('listDevicesiPhone.action.json'), headers: { 'Content-Type' => 'application/json' })
114
+
115
+ stub_request(:post, 'https://developer.apple.com/services-account/QH65B2/account/ios/device/listDevices.action').
116
+ with(body: { deviceClasses: 'ipod', teamId: 'XXXXXXXXXX', pageSize: "500", pageNumber: "1", sort: 'name=asc', includeRemovedDevices: "false" }).
117
+ to_return(status: 200, body: adp_read_fixture_file('listDevicesiPod.action.json'), headers: { 'Content-Type' => 'application/json' })
118
+
119
+ stub_request(:post, 'https://developer.apple.com/services-account/QH65B2/account/ios/device/listDevices.action').
120
+ with(body: { deviceClasses: 'tvOS', teamId: 'XXXXXXXXXX', pageSize: "500", pageNumber: "1", sort: 'name=asc' }).
121
+ to_return(status: 200, body: adp_read_fixture_file('listDevicesTV.action.json'), headers: { 'Content-Type' => 'application/json' })
122
+
123
+ stub_request(:post, 'https://developer.apple.com/services-account/QH65B2/account/ios/device/listDevices.action').
124
+ with(body: { deviceClasses: 'watch', teamId: 'XXXXXXXXXX', pageSize: "500", pageNumber: "1", sort: 'name=asc', includeRemovedDevices: "false" }).
125
+ to_return(status: 200, body: adp_read_fixture_file('listDevicesWatch.action.json'), headers: { 'Content-Type' => 'application/json' })
126
+
127
+ stub_request(:post, 'https://developer.apple.com/services-account/QH65B2/account/ios/device/listDevices.action').
128
+ with(body: { deviceClasses: 'tvOS', teamId: 'XXXXXXXXXX', pageSize: "500", pageNumber: "1", sort: 'name=asc', includeRemovedDevices: "false" }).
129
+ to_return(status: 200, body: adp_read_fixture_file('listDevicesTV.action.json'), headers: { 'Content-Type' => 'application/json' })
130
+
131
+ stub_request(:post, 'https://developer.apple.com/services-account/QH65B2/account/ios/device/listDevices.action').
132
+ with(body: { deviceClasses: 'watch', teamId: 'XXXXXXXXXX', pageSize: "500", pageNumber: "1", sort: 'name=asc', includeRemovedDevices: "false" }).
133
+ to_return(status: 200, body: adp_read_fixture_file('listDevicesWatch.action.json'), headers: { 'Content-Type' => 'application/json' })
134
+
135
+ stub_request(:post, 'https://developer.apple.com/services-account/QH65B2/account/ios/device/listDevices.action').
136
+ with(body: { teamId: 'XXXXXXXXXX', pageSize: "500", pageNumber: "1", sort: 'name=asc', includeRemovedDevices: "false" }).
137
+ to_return(status: 200, body: adp_read_fixture_file('listDevices.action.json'), headers: { 'Content-Type' => 'application/json' })
138
+
139
+ stub_request(:post, 'https://developer.apple.com/services-account/QH65B2/account/ios/device/listDevices.action').
140
+ with(body: { teamId: 'XXXXXXXXXX', pageSize: "500", pageNumber: "1", sort: 'name=asc', includeRemovedDevices: "true" }).
141
+ to_return(status: 200, body: adp_read_fixture_file('listDevicesDisabled.action.json'), headers: { 'Content-Type' => 'application/json' })
142
+
143
+ stub_request(:post, 'https://developer.apple.com/services-account/QH65B2/account/ios/device/deleteDevice.action').
144
+ with(body: { "deviceId" => "AAAAAAAAAA", "teamId" => "XXXXXXXXXX" }).
145
+ to_return(status: 200, body: adp_read_fixture_file('deleteDevice.action.json'), headers: { 'Content-Type' => 'application/json' })
146
+
147
+ stub_request(:post, 'https://developer.apple.com/services-account/QH65B2/account/ios/device/enableDevice.action').
148
+ with(body: { "deviceNumber" => "44ee59893cb94ead4635743b25012e5b9f8c67c1", "displayId" => "DISABLED_B", "teamId" => "XXXXXXXXXX" }).
149
+ to_return(status: 200, body: adp_read_fixture_file('enableDevice.action.json'), headers: { 'Content-Type' => 'application/json' })
150
+
151
+ # Register a new device
152
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/device/addDevices.action").
153
+ with(body: { "deviceClasses" => "iphone", "deviceNames" => "Demo Device", "deviceNumbers" => "7f6c8dc83d77134b5a3a1c53f1202b395b04482b", "register" => "single", "teamId" => "XXXXXXXXXX" }).
154
+ to_return(status: 200, body: adp_read_fixture_file('addDeviceResponse.action.json'), headers: { 'Content-Type' => 'application/json' })
155
+
156
+ # Custom paging
157
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/device/listDevices.action").
158
+ with(body: { "pageNumber" => "1", "pageSize" => "8", "sort" => "name=asc", "teamId" => "XXXXXXXXXX", includeRemovedDevices: "false" }).
159
+ to_return(status: 200, body: adp_read_fixture_file('listDevicesPage1-2.action.json'), headers: { 'Content-Type' => 'application/json' })
160
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/device/listDevices.action").
161
+ with(body: { "pageNumber" => "2", "pageSize" => "8", "sort" => "name=asc", "teamId" => "XXXXXXXXXX", includeRemovedDevices: "false" }).
162
+ to_return(status: 200, body: adp_read_fixture_file('listDevicesPage2-2.action.json'), headers: { 'Content-Type' => 'application/json' })
163
+ end
164
+
165
+ def adp_stub_certificates
166
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/certificate/listCertRequests.action").
167
+ with(body: { "pageNumber" => "1", "pageSize" => "500", "sort" => "certRequestStatusCode=asc", "teamId" => "XXXXXXXXXX", "types" => "5QPB9NHCEI,R58UK2EWSO,9RQEK7MSXA,LA30L5BJEU,BKLRAVXMGM,UPV3DW712I,Y3B2F3TYSI,3T2ZP62QW8,E5D663CMZW,4APLUP237T,T44PTHVNID,DZQUP8189Y,FGQUP4785Z,S5WE21TULA,3BQKVH9I2X,FUOY7LWJET" }).
168
+ to_return(status: 200, body: adp_read_fixture_file('listCertRequests.action.json'), headers: { 'Content-Type' => 'application/json' })
169
+
170
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/certificate/listCertRequests.action").
171
+ with(body: { "pageNumber" => "1", "pageSize" => "500", "sort" => "certRequestStatusCode=asc", 'teamId' => 'XXXXXXXXXX', 'types' => '5QPB9NHCEI' }).
172
+ to_return(status: 200, body: adp_read_fixture_file("list_certificates_filtered.json"), headers: { 'Content-Type' => 'application/json' })
173
+
174
+ # When looking for distribution or development certificates only:
175
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/certificate/listCertRequests.action").
176
+ with(body: { "pageNumber" => "1", "pageSize" => "500", "sort" => "certRequestStatusCode=asc", 'teamId' => 'XXXXXXXXXX', 'types' => 'R58UK2EWSO' }).
177
+ to_return(status: 200, body: adp_read_fixture_file("list_certificates_filtered.json"), headers: { 'Content-Type' => 'application/json' })
178
+
179
+ stub_request(:get, "https://developer.apple.com/services-account/QH65B2/account/ios/certificate/downloadCertificateContent.action?certificateId=XC5PH8DAAA&teamId=XXXXXXXXXX&type=R58UK2EAAA").
180
+ to_return(status: 200, body: adp_read_fixture_file('aps_development.cer'))
181
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/certificate/submitCertificateRequest.action").
182
+ with(body: { "appIdId" => "2HNR359G63", "csrContent" => adp_read_fixture_file('certificateSigningRequest.certSigningRequest'), "type" => "BKLRAVXMGM", "teamId" => "XXXXXXXXXX" }).
183
+ to_return(status: 200, body: adp_read_fixture_file('submitCertificateRequest.action.json'), headers: { 'Content-Type' => 'application/json' })
184
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/certificate/revokeCertificate.action").
185
+ with(body: { "certificateId" => "XC5PH8DAAA", "teamId" => "XXXXXXXXXX", "type" => "R58UK2EAAA" }).
186
+ to_return(status: 200, body: adp_read_fixture_file('revokeCertificate.action.json'), headers: { 'Content-Type' => 'application/json' })
187
+ end
188
+
189
+ def adp_stub_apps
190
+ stub_request(:post, 'https://developer.apple.com/services-account/QH65B2/account/ios/identifiers/listAppIds.action').
191
+ with(body: { teamId: 'XXXXXXXXXX', pageSize: "500", pageNumber: "1", sort: 'name=asc' }).
192
+ to_return(status: 200, body: adp_read_fixture_file('listApps.action.json'), headers: { 'Content-Type' => 'application/json' })
193
+
194
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/mac/identifiers/listAppIds.action").
195
+ with(body: { "pageNumber" => "1", "pageSize" => "500", "sort" => "name=asc", "teamId" => "XXXXXXXXXX" }).
196
+ to_return(status: 200, body: adp_read_fixture_file('listAppsMac.action.json'), headers: { 'Content-Type' => 'application/json' })
197
+
198
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/identifiers/getAppIdDetail.action").
199
+ with(body: { appIdId: "B7JBD8LHAA", teamId: "XXXXXXXXXX" }).
200
+ to_return(status: 200, body: adp_read_fixture_file('getAppIdDetail.action.json'), headers: { 'Content-Type' => 'application/json' })
201
+
202
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/identifiers/addAppId.action").
203
+ with(body: { "name" => "Production App", "identifier" => "tools.fastlane.spaceship.some-explicit-app", "gameCenter" => "on", "inAppPurchase" => "on", "push" => "on", "teamId" => "XXXXXXXXXX", "type" => "explicit" }).
204
+ to_return(status: 200, body: adp_read_fixture_file('addAppId.action.explicit.json'), headers: { 'Content-Type' => 'application/json' })
205
+
206
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/identifiers/addAppId.action").
207
+ with(body: { "name" => "Development App", "identifier" => "tools.fastlane.spaceship.*", "teamId" => "XXXXXXXXXX", "type" => "wildcard" }).
208
+ to_return(status: 200, body: adp_read_fixture_file('addAppId.action.wildcard.json'), headers: { 'Content-Type' => 'application/json' })
209
+
210
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/identifiers/addAppId.action").
211
+ with(body: { "gameCenter" => "on", "identifier" => "tools.fastlane.spaceship.some-explicit-app", "inAppPurchase" => "on", "name" => "pp Test 1ed9e25c93ac7142ff9df53e7f80e84c", "push" => "on", "teamId" => "XXXXXXXXXX", "type" => "explicit" }).
212
+ to_return(status: 200, body: adp_read_fixture_file('addAppId.action.apostroph.json'), headers: { 'Content-Type' => 'application/json' })
213
+
214
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/identifiers/deleteAppId.action").
215
+ with(body: { "appIdId" => "LXD24VUE49", "teamId" => "XXXXXXXXXX" }).
216
+ to_return(status: 200, body: adp_read_fixture_file('deleteAppId.action.json'), headers: { 'Content-Type' => 'application/json' })
217
+
218
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/identifiers/addAppId.action").
219
+ with(body: { "gameCenter" => "on", "identifier" => "tools.fastlane.spaceship.some-explicit-app", "inAppPurchase" => "on", "name" => "Production App", "push" => "true", "teamId" => "XXXXXXXXXX", "type" => "explicit" }).
220
+ to_return(status: 200, body: adp_read_fixture_file('addAppId.action.nopush.json'), headers: { 'Content-Type' => 'application/json' })
221
+ end
222
+
223
+ def adp_stub_persons
224
+ # get all members
225
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/getTeamMembers").
226
+ with(body: "{\"teamId\":\"XXXXXXXXXX\"}").
227
+ to_return(status: 200, body: adp_read_fixture_file("peopleList.json"), headers: { 'Content-Type' => 'application/json' })
228
+
229
+ # invite new member
230
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/sendInvites").
231
+ with(body: "{\"invites\":[{\"recipientEmail\":\"helmut@januschka.com\",\"recipientRole\":\"admin\"}],\"teamId\":\"XXXXXXXXXX\"}").
232
+ to_return(status: 200, body: "", headers: {})
233
+
234
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/removeTeamMembers").
235
+ with(body: "{\"teamId\":\"XXXXXXXXXX\",\"teamMemberIds\":[\"5M8TWKRZ3J\"]}").
236
+ to_return(status: 200, body: "", headers: {})
237
+
238
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/setTeamMemberRoles").
239
+ with(body: "{\"teamId\":\"XXXXXXXXXX\",\"role\":\"member\",\"teamMemberIds\":[\"5M8TWKRZ3J\"]}").
240
+ to_return(status: 200, body: "", headers: {})
241
+ end
242
+
243
+ def adp_stub_app_groups
244
+ stub_request(:post, 'https://developer.apple.com/services-account/QH65B2/account/ios/identifiers/listApplicationGroups.action').
245
+ with(body: { teamId: 'XXXXXXXXXX', pageSize: "500", pageNumber: "1", sort: 'name=asc' }).
246
+ to_return(status: 200, body: adp_read_fixture_file('listApplicationGroups.action.json'), headers: { 'Content-Type' => 'application/json' })
247
+
248
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/identifiers/addApplicationGroup.action").
249
+ with(body: { "name" => "Production App Group", "identifier" => "group.tools.fastlane.spaceship", "teamId" => "XXXXXXXXXX" }).
250
+ to_return(status: 200, body: adp_read_fixture_file('addApplicationGroup.action.json'), headers: { 'Content-Type' => 'application/json' })
251
+
252
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/identifiers/deleteApplicationGroup.action").
253
+ with(body: { "applicationGroup" => "2GKKV64NUG", "teamId" => "XXXXXXXXXX" }).
254
+ to_return(status: 200, body: adp_read_fixture_file('deleteApplicationGroup.action.json'), headers: { 'Content-Type' => 'application/json' })
255
+ end
256
+
257
+ def adp_stub_website_pushes
258
+ stub_request(:post, 'https://developer.apple.com/services-account/QH65B2/account/ios/identifiers/listWebsitePushIds.action').
259
+ with(body: { teamId: 'XXXXXXXXXX', pageSize: "500", pageNumber: "1", sort: 'name=asc' }).
260
+ to_return(status: 200, body: adp_read_fixture_file('listWebsitePushIds.action.json'), headers: { 'Content-Type' => 'application/json' })
261
+
262
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/mac/identifiers/listWebsitePushIds.action").
263
+ with(body: { "pageNumber" => "1", "pageSize" => "500", "sort" => "name=asc", "teamId" => "XXXXXXXXXX" }).
264
+ to_return(status: 200, body: adp_read_fixture_file('listWebsitePushIds.action.json'), headers: { 'Content-Type' => 'application/json' })
265
+
266
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/identifiers/addWebsitePushId.action").
267
+ with(body: { "name" => "Fastlane Website Push", "identifier" => "web.com.fastlane.example", "teamId" => "XXXXXXXXXX" }).
268
+ to_return(status: 200, body: adp_read_fixture_file('addWebsitePushId.action.json'), headers: { 'Content-Type' => 'application/json' })
269
+
270
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/mac/identifiers/addWebsitePushId.action").
271
+ with(body: { "name" => "Fastlane Website Push", "identifier" => "web.com.fastlane.example", "teamId" => "XXXXXXXXXX" }).
272
+ to_return(status: 200, body: adp_read_fixture_file('addWebsitePushId.action.json'), headers: { 'Content-Type' => 'application/json' })
273
+
274
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/identifiers/deleteWebsitePushId.action").
275
+ with(body: { "websitePushId" => "R7878HDXC3", "teamId" => "XXXXXXXXXX" }).
276
+ to_return(status: 200, body: adp_read_fixture_file('deleteWebsitePushId.action.json'), headers: { 'Content-Type' => 'application/json' })
277
+
278
+ stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/mac/identifiers/deleteWebsitePushId.action").
279
+ with(body: { "websitePushId" => "R7878HDXC3", "teamId" => "XXXXXXXXXX" }).
280
+ to_return(status: 200, body: adp_read_fixture_file('deleteWebsitePushId.action.json'), headers: { 'Content-Type' => 'application/json' })
281
+ end
282
+
283
+ def adp_stub_download_certificate_failure
284
+ stub_request(:get, 'https://developer.apple.com/services-account/QH65B2/account/ios/certificate/downloadCertificateContent.action?certificateId=XC5PH8DAAA&teamId=XXXXXXXXXX&type=R58UK2EAAA').
285
+ to_return(status: 404, body: adp_read_fixture_file('download_certificate_failure.html'))
286
+ end
287
+
288
+ def adp_stub_download_provisioning_profile_failure
289
+ stub_request(:get, "https://developer.apple.com/services-account/QH65B2/account/ios/profile/downloadProfileContent?provisioningProfileId=PP00000001&teamId=XXXXXXXXXX").
290
+ to_return(status: 404, body: adp_read_fixture_file('download_certificate_failure.html'))
291
+ end
292
+ end
293
+ end
@@ -0,0 +1,24 @@
1
+ describe Spaceship::ProvisioningProfile do
2
+ describe "Development tvOS Profiles" do
3
+ before do
4
+ Spaceship.login
5
+ PortalStubbing.adp_enterprise_stubbing
6
+ end
7
+ let(:client) { Spaceship::ProvisioningProfile.client }
8
+
9
+ describe "Create a new Development tvOS Profile" do
10
+ it "uses the correct type for the create request" do
11
+ cert = Spaceship::Certificate::Development.all.first
12
+ result = Spaceship::ProvisioningProfile::Development.create!(name: 'Delete Me', bundle_id: 'net.sunapps.1', certificate: cert, devices: nil, mac: false, sub_platform: 'tvOS')
13
+ expect(result.raw_data['provisioningProfileId']).to eq('W2MY88F6GE')
14
+ end
15
+
16
+ it "does not allow tvos as a subplatform" do
17
+ cert = Spaceship::Certificate::Development.all.first
18
+ expect do
19
+ Spaceship::ProvisioningProfile::Development.create!(name: 'Delete Me', bundle_id: 'net.sunapps.1', certificate: cert, devices: nil, mac: false, sub_platform: 'tvos')
20
+ end.to raise_error('Invalid sub_platform tvos, valid values are tvOS')
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,57 @@
1
+ describe Spaceship::Portal::WebsitePush do
2
+ before { Spaceship.login }
3
+ let(:client) { Spaceship::Portal::WebsitePush.client }
4
+
5
+ describe "successfully loads and parses all website pushes" do
6
+ it "the number is correct" do
7
+ expect(Spaceship::Portal::WebsitePush.all.count).to eq(2)
8
+ end
9
+
10
+ it "inspect works" do
11
+ expect(Spaceship::Portal::WebsitePush.all.first.inspect).to include("Portal::WebsitePush")
12
+ end
13
+
14
+ it "parses website pushes correctly" do
15
+ website_push = Spaceship::Portal::WebsitePush.all.first
16
+
17
+ expect(website_push.bundle_id).to eq("web.com.example.one")
18
+ expect(website_push.name).to eq("First Website Push")
19
+ expect(website_push.status).to eq("current")
20
+ expect(website_push.website_id).to eq("44V62UZ8L7")
21
+ expect(website_push.prefix).to eq("9J57U9392R")
22
+ end
23
+
24
+ it "allows modification of values and properly retrieving them" do
25
+ website_push = Spaceship::WebsitePush.all.first
26
+ website_push.name = "12"
27
+ expect(website_push.name).to eq("12")
28
+ end
29
+ end
30
+
31
+ describe "Filter website pushes based on group identifier" do
32
+ it "works with specific Website Push IDs" do
33
+ website_push = Spaceship::Portal::WebsitePush.find("web.com.example.two")
34
+ expect(website_push.website_id).to eq("R7878HDXC3")
35
+ end
36
+
37
+ it "returns nil website push ID wasn't found" do
38
+ expect(Spaceship::Portal::WebsitePush.find("asdfasdf")).to be_nil
39
+ end
40
+ end
41
+
42
+ describe '#create' do
43
+ it 'creates a website push' do
44
+ expect(client).to receive(:create_website_push!).with('Fastlane Website Push', 'web.com.fastlane.example', mac: false).and_return({})
45
+ website_push = Spaceship::Portal::WebsitePush.create!(bundle_id: 'web.com.fastlane.example', name: 'Fastlane Website Push')
46
+ end
47
+ end
48
+
49
+ describe '#delete' do
50
+ subject { Spaceship::Portal::WebsitePush.find("web.com.example.two") }
51
+ it 'deletes the website push by a given website_id' do
52
+ expect(client).to receive(:delete_website_push!).with('R7878HDXC3', mac: false)
53
+ website_push = subject.delete!
54
+ expect(website_push.website_id).to eq('R7878HDXC3')
55
+ end
56
+ end
57
+ end
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.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minh Luong
@@ -17,6 +17,70 @@ extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
19
  - lib/spaceship_stub.rb
20
+ - lib/spaceship_stub/spaceship/spec/portal/app_group_spec.rb
21
+ - lib/spaceship_stub/spaceship/spec/portal/app_spec.rb
22
+ - lib/spaceship_stub/spaceship/spec/portal/certificate_spec.rb
23
+ - lib/spaceship_stub/spaceship/spec/portal/device_spec.rb
24
+ - lib/spaceship_stub/spaceship/spec/portal/enterprise_spec.rb
25
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/addAppId.action.apostroph.json
26
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/addAppId.action.explicit.json
27
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/addAppId.action.nopush.json
28
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/addAppId.action.wildcard.json
29
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/addApplicationGroup.action.json
30
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/addDeviceResponse.action.json
31
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/addDeviceResponse.action.plist
32
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/addWebsitePushId.action.json
33
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/aps_development.cer
34
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/certificateCreate.certRequest.json
35
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/certificateSigningRequest.certSigningRequest
36
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/create_profile_name_taken.txt
37
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/create_profile_success.json
38
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/deleteAppId.action.json
39
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/deleteApplicationGroup.action.json
40
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/deleteDevice.action.json
41
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/deleteProvisioningProfile.action.json
42
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/deleteWebsitePushId.action.json
43
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/dev_center_provisioning_profiles_response.json
44
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/download_certificate_failure.html
45
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/downloaded_provisioning_profile.mobileprovision
46
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/enableDevice.action.json
47
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/getAppIdDetail.action.json
48
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/getProvisioningProfileAdHoc.action.json
49
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/getProvisioningProfileAppStore.action.json
50
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/getProvisioningProfileDevelopment.action.json
51
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/getProvisioningProfiletvOSAppStore.action.json
52
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/listApplicationGroups.action.json
53
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/listApps.action.json
54
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/listAppsMac.action.json
55
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/listCertRequests.action.json
56
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevices.action.json
57
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesDisabled.action.json
58
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesPage1-2.action.json
59
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesPage2-2.action.json
60
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesTV.action.json
61
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesWatch.action.json
62
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesiPhone.action.json
63
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesiPod.action.json
64
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/listProvisioningProfiles.action.json
65
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/listProvisioningProfiles.action.plist
66
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/listTeams.action.json
67
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/listTeams_multiple.action.json
68
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/listWebsitePushIds.action.json
69
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/list_certificates_filtered.json
70
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/peopleList.json
71
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/profileContentDownload.action
72
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/repair_profile_success.json
73
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/repair_profile_tvos_success.json
74
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/revokeCertificate.action.json
75
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/submitCertificateRequest.action.json
76
+ - lib/spaceship_stub/spaceship/spec/portal/fixtures/updateAppIdName.action.json
77
+ - lib/spaceship_stub/spaceship/spec/portal/person_spec.rb
78
+ - lib/spaceship_stub/spaceship/spec/portal/persons_spec.rb
79
+ - lib/spaceship_stub/spaceship/spec/portal/portal_client_spec.rb
80
+ - lib/spaceship_stub/spaceship/spec/portal/portal_permission_spec.rb
81
+ - lib/spaceship_stub/spaceship/spec/portal/portal_stubbing.rb
82
+ - lib/spaceship_stub/spaceship/spec/portal/tvos_profile_spec.rb
83
+ - lib/spaceship_stub/spaceship/spec/portal/website_push_spec.rb
20
84
  - lib/spaceship_stub/spaceship/spec/tunes/fixtures/app_details.json
21
85
  - lib/spaceship_stub/spaceship/spec/tunes/fixtures/app_overview.json
22
86
  - lib/spaceship_stub/spaceship/spec/tunes/fixtures/app_overview_stuckinprepare.json