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.
- checksums.yaml +4 -4
- data/lib/spaceship_stub/spaceship/spec/portal/app_group_spec.rb +57 -0
- data/lib/spaceship_stub/spaceship/spec/portal/app_spec.rb +136 -0
- data/lib/spaceship_stub/spaceship/spec/portal/certificate_spec.rb +116 -0
- data/lib/spaceship_stub/spaceship/spec/portal/device_spec.rb +142 -0
- data/lib/spaceship_stub/spaceship/spec/portal/enterprise_spec.rb +28 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/addAppId.action.apostroph.json +51 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/addAppId.action.explicit.json +51 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/addAppId.action.nopush.json +50 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/addAppId.action.wildcard.json +49 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/addApplicationGroup.action.json +22 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/addDeviceResponse.action.json +30 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/addDeviceResponse.action.plist +33 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/addWebsitePushId.action.json +22 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/aps_development.cer +0 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/certificateCreate.certRequest.json +44 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/certificateSigningRequest.certSigningRequest +16 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/create_profile_name_taken.txt +1 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/create_profile_success.json +64 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/deleteAppId.action.json +16 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/deleteApplicationGroup.action.json +16 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/deleteDevice.action.json +13 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/deleteProvisioningProfile.action.json +16 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/deleteWebsitePushId.action.json +16 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/dev_center_provisioning_profiles_response.json +829 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/download_certificate_failure.html +13 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/downloaded_provisioning_profile.mobileprovision +51 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/enableDevice.action.json +22 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/getAppIdDetail.action.json +55 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/getProvisioningProfileAdHoc.action.json +108 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/getProvisioningProfileAppStore.action.json +91 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/getProvisioningProfileDevelopment.action.json +108 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/getProvisioningProfiletvOSAppStore.action.json +93 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listApplicationGroups.action.json +30 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listApps.action.json +97 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listAppsMac.action.json +97 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listCertRequests.action.json +80 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevices.action.json +53 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesDisabled.action.json +71 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesPage1-2.action.json +65 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesPage2-2.action.json +23 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesTV.action.json +26 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesWatch.action.json +26 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesiPhone.action.json +44 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listDevicesiPod.action.json +26 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listProvisioningProfiles.action.json +126 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listProvisioningProfiles.action.plist +597 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listTeams.action.json +61 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listTeams_multiple.action.json +105 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/listWebsitePushIds.action.json +31 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/list_certificates_filtered.json +38 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/peopleList.json +34 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/profileContentDownload.action +0 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/repair_profile_success.json +65 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/repair_profile_tvos_success.json +66 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/revokeCertificate.action.json +56 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/submitCertificateRequest.action.json +59 -0
- data/lib/spaceship_stub/spaceship/spec/portal/fixtures/updateAppIdName.action.json +44 -0
- data/lib/spaceship_stub/spaceship/spec/portal/person_spec.rb +27 -0
- data/lib/spaceship_stub/spaceship/spec/portal/persons_spec.rb +19 -0
- data/lib/spaceship_stub/spaceship/spec/portal/portal_client_spec.rb +279 -0
- data/lib/spaceship_stub/spaceship/spec/portal/portal_permission_spec.rb +26 -0
- data/lib/spaceship_stub/spaceship/spec/portal/portal_stubbing.rb +293 -0
- data/lib/spaceship_stub/spaceship/spec/portal/tvos_profile_spec.rb +24 -0
- data/lib/spaceship_stub/spaceship/spec/portal/website_push_spec.rb +57 -0
- metadata +65 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2239c6bb6d04783fb3a1efec9f23407106b041f8
|
4
|
+
data.tar.gz: daa09e43d3817d7635e6e16112bfb3be8d132934
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 443e6fc6c3a1e99fd283bc2d14a865047b3437ca20f046c1c9796698a7e382c30576bf5076d88cc9cff37b3da59b28fcea0ce444a5d037cfb73637b34370c773
|
7
|
+
data.tar.gz: 452e7dbd14d011950faa65a1ff733413e2208ece08fad11c7137f408ffdfb52133f3c87a3f0d204b78abfced1fa08ea7e61509933f9fcbf1867f39a9e42466d6
|
@@ -0,0 +1,57 @@
|
|
1
|
+
describe Spaceship::Portal::AppGroup do
|
2
|
+
before { Spaceship.login }
|
3
|
+
let(:client) { Spaceship::Portal::AppGroup.client }
|
4
|
+
|
5
|
+
describe "successfully loads and parses all app groups" do
|
6
|
+
it "the number is correct" do
|
7
|
+
expect(Spaceship::Portal::AppGroup.all.count).to eq(2)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "inspect works" do
|
11
|
+
expect(Spaceship::Portal::AppGroup.all.first.inspect).to include("Portal::AppGroup")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "parses app group correctly" do
|
15
|
+
group = Spaceship::Portal::AppGroup.all.first
|
16
|
+
|
17
|
+
expect(group.group_id).to eq("group.com.example.one")
|
18
|
+
expect(group.name).to eq("First group")
|
19
|
+
expect(group.status).to eq("current")
|
20
|
+
expect(group.app_group_id).to eq("44V62UZ8L7")
|
21
|
+
expect(group.prefix).to eq("9J57U9392R")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "allows modification of values and properly retrieving them" do
|
25
|
+
group = Spaceship::AppGroup.all.first
|
26
|
+
group.name = "12"
|
27
|
+
expect(group.name).to eq("12")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "Filter app group based on group identifier" do
|
32
|
+
it "works with specific App Group IDs" do
|
33
|
+
group = Spaceship::Portal::AppGroup.find("group.com.example.two")
|
34
|
+
expect(group.app_group_id).to eq("2GKKV64NUG")
|
35
|
+
end
|
36
|
+
|
37
|
+
it "returns nil app group ID wasn't found" do
|
38
|
+
expect(Spaceship::Portal::AppGroup.find("asdfasdf")).to be_nil
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#create' do
|
43
|
+
it 'creates an app group' do
|
44
|
+
expect(client).to receive(:create_app_group!).with('Production App Group', 'group.tools.fastlane').and_return({})
|
45
|
+
group = Spaceship::Portal::AppGroup.create!(group_id: 'group.tools.fastlane', name: 'Production App Group')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '#delete' do
|
50
|
+
subject { Spaceship::Portal::AppGroup.find("group.com.example.two") }
|
51
|
+
it 'deletes the app group by a given app_group_id' do
|
52
|
+
expect(client).to receive(:delete_app_group!).with('2GKKV64NUG')
|
53
|
+
group = subject.delete!
|
54
|
+
expect(group.app_group_id).to eq('2GKKV64NUG')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
describe Spaceship::Portal::App do
|
2
|
+
before { Spaceship.login }
|
3
|
+
let(:client) { Spaceship::Portal::App.client }
|
4
|
+
|
5
|
+
describe "successfully loads and parses all apps" do
|
6
|
+
it "the number is correct" do
|
7
|
+
expect(Spaceship::Portal::App.all.count).to eq(5)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "inspect works" do
|
11
|
+
expect(Spaceship::Portal::App.all.first.inspect).to include("Portal::App")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "parses app correctly" do
|
15
|
+
app = Spaceship::Portal::App.all.first
|
16
|
+
|
17
|
+
expect(app.app_id).to eq("B7JBD8LHAA")
|
18
|
+
expect(app.name).to eq("The App Name")
|
19
|
+
expect(app.platform).to eq("ios")
|
20
|
+
expect(app.prefix).to eq("5A997XSHK2")
|
21
|
+
expect(app.bundle_id).to eq("net.sunapps.151")
|
22
|
+
expect(app.is_wildcard).to eq(false)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "parses wildcard apps correctly" do
|
26
|
+
app = Spaceship::Portal::App.all.last
|
27
|
+
|
28
|
+
expect(app.app_id).to eq("L42E9BTRAA")
|
29
|
+
expect(app.name).to eq("SunApps")
|
30
|
+
expect(app.platform).to eq("ios")
|
31
|
+
expect(app.prefix).to eq("5A997XSHK2")
|
32
|
+
expect(app.bundle_id).to eq("net.sunapps.*")
|
33
|
+
expect(app.is_wildcard).to eq(true)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "parses app details correctly" do
|
37
|
+
app = Spaceship::Portal::App.all.first
|
38
|
+
app = app.details
|
39
|
+
|
40
|
+
expect(app.app_id).to eq("B7JBD8LHAA")
|
41
|
+
expect(app.name).to eq("The App Name")
|
42
|
+
expect(app.platform).to eq("ios")
|
43
|
+
expect(app.prefix).to eq("5A997XSHK2")
|
44
|
+
expect(app.bundle_id).to eq("net.sunapps.151")
|
45
|
+
expect(app.is_wildcard).to eq(false)
|
46
|
+
|
47
|
+
expect(app.features).to include("push" => true)
|
48
|
+
expect(app.enable_services).to include("push")
|
49
|
+
expect(app.dev_push_enabled).to eq(false)
|
50
|
+
expect(app.prod_push_enabled).to eq(true)
|
51
|
+
expect(app.app_groups_count).to eq(0)
|
52
|
+
expect(app.cloud_containers_count).to eq(0)
|
53
|
+
expect(app.identifiers_count).to eq(0)
|
54
|
+
expect(app.associated_groups.length).to eq(1)
|
55
|
+
expect(app.associated_groups[0].group_id).to eq("group.tools.fastlane")
|
56
|
+
end
|
57
|
+
|
58
|
+
it "allows modification of values and properly retrieving them" do
|
59
|
+
app = Spaceship::App.all.first
|
60
|
+
app.name = "12"
|
61
|
+
expect(app.name).to eq("12")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "Filter app based on app identifier" do
|
66
|
+
it "works with specific App IDs" do
|
67
|
+
app = Spaceship::Portal::App.find("net.sunapps.151")
|
68
|
+
expect(app.app_id).to eq("B7JBD8LHAA")
|
69
|
+
expect(app.is_wildcard).to eq(false)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "works with specific App IDs even with different case" do
|
73
|
+
app = Spaceship::Portal::App.find("net.sunaPPs.151")
|
74
|
+
expect(app.app_id).to eq("B7JBD8LHAA")
|
75
|
+
expect(app.is_wildcard).to eq(false)
|
76
|
+
end
|
77
|
+
|
78
|
+
it "works with wilcard App IDs" do
|
79
|
+
app = Spaceship::Portal::App.find("net.sunapps.*")
|
80
|
+
expect(app.app_id).to eq("L42E9BTRAA")
|
81
|
+
expect(app.is_wildcard).to eq(true)
|
82
|
+
end
|
83
|
+
|
84
|
+
it "returns nil app ID wasn't found" do
|
85
|
+
expect(Spaceship::Portal::App.find("asdfasdf")).to be_nil
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe '#create' do
|
90
|
+
it 'creates an app id with an explicit bundle_id' do
|
91
|
+
expect(client).to receive(:create_app!).with(:explicit, 'Production App', 'tools.fastlane.spaceship.some-explicit-app', mac: false, enable_services: {}) {
|
92
|
+
{ 'isWildCard' => true }
|
93
|
+
}
|
94
|
+
app = Spaceship::Portal::App.create!(bundle_id: 'tools.fastlane.spaceship.some-explicit-app', name: 'Production App')
|
95
|
+
expect(app.is_wildcard).to eq(true)
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'creates an app id with an explicit bundle_id and no push notifications' do
|
99
|
+
expect(client).to receive(:create_app!).with(:explicit, 'Production App', 'tools.fastlane.spaceship.some-explicit-app', mac: false, enable_services: { push_notification: "off" }) {
|
100
|
+
{ 'enabledFeatures' => ["inAppPurchase"] }
|
101
|
+
}
|
102
|
+
app = Spaceship::Portal::App.create!(bundle_id: 'tools.fastlane.spaceship.some-explicit-app', name: 'Production App', enable_services: { push_notification: "off" })
|
103
|
+
expect(app.enable_services).not_to include("push")
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'creates an app id with a wildcard bundle_id' do
|
107
|
+
expect(client).to receive(:create_app!).with(:wildcard, 'Development App', 'tools.fastlane.spaceship.*', mac: false, enable_services: {}) {
|
108
|
+
{ 'isWildCard' => false }
|
109
|
+
}
|
110
|
+
app = Spaceship::Portal::App.create!(bundle_id: 'tools.fastlane.spaceship.*', name: 'Development App')
|
111
|
+
expect(app.is_wildcard).to eq(false)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe '#delete' do
|
116
|
+
subject { Spaceship::Portal::App.find("net.sunapps.151") }
|
117
|
+
it 'deletes the app by a given bundle_id' do
|
118
|
+
expect(client).to receive(:delete_app!).with('B7JBD8LHAA', mac: false)
|
119
|
+
app = subject.delete!
|
120
|
+
expect(app.app_id).to eq('B7JBD8LHAA')
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
describe '#update_name' do
|
125
|
+
subject { Spaceship::Portal::App.find("net.sunapps.151") }
|
126
|
+
it 'updates the name of the app by given bundle_id' do
|
127
|
+
stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/identifiers/updateAppIdName.action").
|
128
|
+
with(body: { "appIdId" => "B7JBD8LHAA", "name" => "The New Name", "teamId" => "XXXXXXXXXX" }).
|
129
|
+
to_return(status: 200, body: PortalStubbing.adp_read_fixture_file('updateAppIdName.action.json'), headers: { 'Content-Type' => 'application/json' })
|
130
|
+
|
131
|
+
app = subject.update_name!('The New Name')
|
132
|
+
expect(app.app_id).to eq('B7JBD8LHAA')
|
133
|
+
expect(app.name).to eq('The New Name')
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
describe Spaceship::Certificate do
|
2
|
+
before { Spaceship.login }
|
3
|
+
let(:client) { Spaceship::Portal::Certificate.client }
|
4
|
+
|
5
|
+
describe "successfully loads and parses all certificates" do
|
6
|
+
it "the number is correct" do
|
7
|
+
expect(Spaceship::Portal::Certificate.all.count).to eq(3)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "inspect works" do
|
11
|
+
expect(Spaceship::Portal::Certificate.all.first.inspect).to include("Portal::Certificate")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "parses code signing identities correctly" do
|
15
|
+
cert = Spaceship::Portal::Certificate.all.first
|
16
|
+
|
17
|
+
expect(cert.id).to eq('XC5PH8DAAA')
|
18
|
+
expect(cert.name).to eq('SunApps GmbH')
|
19
|
+
expect(cert.status).to eq('Issued')
|
20
|
+
expect(cert.created.class).to eq(Time)
|
21
|
+
expect(cert.expires.class).to eq(Time)
|
22
|
+
expect(cert.created.to_s).to eq('2014-11-25 22:55:50 UTC')
|
23
|
+
expect(cert.expires.to_s).to eq('2015-11-25 22:45:50 UTC')
|
24
|
+
expect(cert.owner_type).to eq('team')
|
25
|
+
expect(cert.owner_name).to eq('SunApps GmbH')
|
26
|
+
expect(cert.owner_id).to eq('5A997XSAAA')
|
27
|
+
expect(cert.is_push?).to eq(false)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "parses push certificates correctly" do
|
31
|
+
push = Spaceship::Portal::Certificate.find('32KPRBAAAA') # that's the push certificate
|
32
|
+
|
33
|
+
expect(push.id).to eq('32KPRBAAAA')
|
34
|
+
expect(push.name).to eq('net.sunapps.54')
|
35
|
+
expect(push.status).to eq('Issued')
|
36
|
+
expect(push.created.to_s).to eq('2015-04-02 21:34:00 UTC')
|
37
|
+
expect(push.expires.to_s).to eq('2016-04-01 21:24:00 UTC')
|
38
|
+
expect(push.owner_type).to eq('bundle')
|
39
|
+
expect(push.owner_name).to eq('Timelack')
|
40
|
+
expect(push.owner_id).to eq('3599RCHAAA')
|
41
|
+
expect(push.is_push?).to eq(true)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it "Correctly filters the listed certificates" do
|
46
|
+
certs = Spaceship::Portal::Certificate::Development.all
|
47
|
+
expect(certs.count).to eq(1)
|
48
|
+
|
49
|
+
cert = certs.first
|
50
|
+
expect(cert.id).to eq('C8DL7464RQ')
|
51
|
+
expect(cert.name).to eq('Felix Krause')
|
52
|
+
expect(cert.status).to eq('Issued')
|
53
|
+
expect(cert.created.to_s).to eq('2014-11-25 22:55:50 UTC')
|
54
|
+
expect(cert.expires.to_s).to eq('2015-11-25 22:45:50 UTC')
|
55
|
+
expect(cert.owner_type).to eq('teamMember')
|
56
|
+
expect(cert.owner_name).to eq('Felix Krause')
|
57
|
+
expect(cert.owner_id).to eq('5Y354CXU3A')
|
58
|
+
expect(cert.is_push?).to eq(false)
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#download' do
|
62
|
+
let(:cert) { Spaceship::Portal::Certificate.all.first }
|
63
|
+
it 'downloads the associated .cer file' do
|
64
|
+
x509 = OpenSSL::X509::Certificate.new(cert.download)
|
65
|
+
expect(x509.issuer.to_s).to match('Apple Worldwide Developer Relations')
|
66
|
+
end
|
67
|
+
|
68
|
+
it "handles failed download request" do
|
69
|
+
PortalStubbing.adp_stub_download_certificate_failure
|
70
|
+
|
71
|
+
error_text = /^Couldn't download certificate, got this instead:/
|
72
|
+
expect do
|
73
|
+
cert.download
|
74
|
+
end.to raise_error(Spaceship::Client::UnexpectedResponse, error_text)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe '#revoke' do
|
79
|
+
let(:cert) { Spaceship::Portal::Certificate.all.first }
|
80
|
+
it 'revokes certificate by the given cert id' do
|
81
|
+
expect(client).to receive(:revoke_certificate!).with('XC5PH8DAAA', 'R58UK2EAAA', mac: false)
|
82
|
+
cert.revoke!
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe '#create' do
|
87
|
+
it 'should create and return a new certificate' do
|
88
|
+
expect(client).to receive(:create_certificate!).with('UPV3DW712I', /BEGIN CERTIFICATE REQUEST/, 'B7JBD8LHAA', false) {
|
89
|
+
JSON.parse(PortalStubbing.adp_read_fixture_file('certificateCreate.certRequest.json'))
|
90
|
+
}
|
91
|
+
csr, pkey = Spaceship::Portal::Certificate.create_certificate_signing_request
|
92
|
+
certificate = Spaceship::Portal::Certificate::ProductionPush.create!(csr: csr, bundle_id: 'net.sunapps.151')
|
93
|
+
expect(certificate).to be_instance_of(Spaceship::Portal::Certificate::ProductionPush)
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'should create a new certificate using a CSR from a file' do
|
97
|
+
expect(client).to receive(:create_certificate!).with('UPV3DW712I', /BEGIN CERTIFICATE REQUEST/, 'B7JBD8LHAA', false) {
|
98
|
+
JSON.parse(PortalStubbing.adp_read_fixture_file('certificateCreate.certRequest.json'))
|
99
|
+
}
|
100
|
+
csr, pkey = Spaceship::Portal::Certificate.create_certificate_signing_request
|
101
|
+
Tempfile.open('csr') do |f|
|
102
|
+
f.write(csr.to_pem)
|
103
|
+
f.rewind
|
104
|
+
pem = f.read
|
105
|
+
Spaceship::Portal::Certificate::ProductionPush.create!(csr: pem, bundle_id: 'net.sunapps.151')
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
it 'raises an error if the user wants to create a certificate for a non-existing app' do
|
110
|
+
expect do
|
111
|
+
csr, pkey = Spaceship::Portal::Certificate.create_certificate_signing_request
|
112
|
+
Spaceship::Portal::Certificate::ProductionPush.create!(csr: csr, bundle_id: 'notExisting')
|
113
|
+
end.to raise_error "Could not find app with bundle id 'notExisting'"
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,142 @@
|
|
1
|
+
describe Spaceship::Device do
|
2
|
+
before { Spaceship.login }
|
3
|
+
let(:client) { Spaceship::Device.client }
|
4
|
+
|
5
|
+
subject(:all_devices) { Spaceship::Device.all }
|
6
|
+
it "successfully loads and parses all devices" do
|
7
|
+
expect(all_devices.count).to eq(4)
|
8
|
+
device = all_devices.first
|
9
|
+
expect(device.id).to eq('AAAAAAAAAA')
|
10
|
+
expect(device.name).to eq('Felix\'s iPhone')
|
11
|
+
expect(device.udid).to eq('a03b816861e89fac0a4da5884cb9d2f01bd5641e')
|
12
|
+
expect(device.platform).to eq('ios')
|
13
|
+
expect(device.status).to eq('c')
|
14
|
+
expect(device.model).to eq('iPhone 5 (Model A1428)')
|
15
|
+
expect(device.device_type).to eq('iphone')
|
16
|
+
end
|
17
|
+
|
18
|
+
subject(:all_devices_disabled) { Spaceship::Device.all(include_disabled: true) }
|
19
|
+
it "successfully loads and parses all devices including disabled ones" do
|
20
|
+
expect(all_devices_disabled.count).to eq(6)
|
21
|
+
device = all_devices_disabled.last
|
22
|
+
expect(device.id).to eq('DISABLED_B')
|
23
|
+
expect(device.name).to eq('Old iPod')
|
24
|
+
expect(device.udid).to eq('44ee59893cb94ead4635743b25012e5b9f8c67c1')
|
25
|
+
expect(device.platform).to eq('ios')
|
26
|
+
expect(device.status).to eq('r')
|
27
|
+
expect(device.model).to eq('iPod touch')
|
28
|
+
expect(device.device_type).to eq('ipod')
|
29
|
+
end
|
30
|
+
|
31
|
+
subject(:all_phones) { Spaceship::Device.all_iphones }
|
32
|
+
it "successfully loads and parses all iPhones" do
|
33
|
+
expect(all_phones.count).to eq(3)
|
34
|
+
device = all_phones.first
|
35
|
+
expect(device.id).to eq('AAAAAAAAAA')
|
36
|
+
expect(device.name).to eq('Felix\'s iPhone')
|
37
|
+
expect(device.udid).to eq('a03b816861e89fac0a4da5884cb9d2f01bd5641e')
|
38
|
+
expect(device.platform).to eq('ios')
|
39
|
+
expect(device.status).to eq('c')
|
40
|
+
expect(device.model).to eq('iPhone 5 (Model A1428)')
|
41
|
+
expect(device.device_type).to eq('iphone')
|
42
|
+
end
|
43
|
+
|
44
|
+
subject(:all_ipods) { Spaceship::Device.all_ipod_touches }
|
45
|
+
it "successfully loads and parses all iPods" do
|
46
|
+
expect(all_ipods.count).to eq(1)
|
47
|
+
device = all_ipods.first
|
48
|
+
expect(device.id).to eq('CCCCCCCCCC')
|
49
|
+
expect(device.name).to eq('Personal iPhone')
|
50
|
+
expect(device.udid).to eq('97467684eb8dfa3c6d272eac3890dab0d001c706')
|
51
|
+
expect(device.platform).to eq('ios')
|
52
|
+
expect(device.status).to eq('c')
|
53
|
+
expect(device.model).to eq(nil)
|
54
|
+
expect(device.device_type).to eq('ipod')
|
55
|
+
end
|
56
|
+
|
57
|
+
subject(:all_apple_tvs) { Spaceship::Device.all_apple_tvs }
|
58
|
+
it "successfully loads and parses all Apple TVs" do
|
59
|
+
expect(all_apple_tvs.count).to eq(1)
|
60
|
+
device = all_apple_tvs.first
|
61
|
+
expect(device.id).to eq('EEEEEEEEEE')
|
62
|
+
expect(device.name).to eq('Tracy\'s Apple TV')
|
63
|
+
expect(device.udid).to eq('8defe35b2cad44affacabd124834acbd8746ff34')
|
64
|
+
expect(device.platform).to eq('ios')
|
65
|
+
expect(device.status).to eq('c')
|
66
|
+
expect(device.model).to eq('The new Apple TV')
|
67
|
+
expect(device.device_type).to eq('tvOS')
|
68
|
+
end
|
69
|
+
|
70
|
+
subject(:all_watches) { Spaceship::Device.all_watches }
|
71
|
+
it "successfully loads and parses all Watches" do
|
72
|
+
expect(all_watches.count).to eq(1)
|
73
|
+
device = all_watches.first
|
74
|
+
expect(device.id).to eq('FFFFFFFFFF')
|
75
|
+
expect(device.name).to eq('Tracy\'s Watch')
|
76
|
+
expect(device.udid).to eq('8defe35b2cad44aff7d8e9dfe4ca4d2fb94ae509')
|
77
|
+
expect(device.platform).to eq('ios')
|
78
|
+
expect(device.status).to eq('c')
|
79
|
+
expect(device.model).to eq('Apple Watch 38mm')
|
80
|
+
expect(device.device_type).to eq('watch')
|
81
|
+
end
|
82
|
+
|
83
|
+
it "inspect works" do
|
84
|
+
expect(subject.first.inspect).to include("Portal::Device")
|
85
|
+
end
|
86
|
+
|
87
|
+
describe "#find" do
|
88
|
+
it "finds a device by its ID" do
|
89
|
+
device = Spaceship::Device.find("AAAAAAAAAA")
|
90
|
+
expect(device.id).to eq("AAAAAAAAAA")
|
91
|
+
expect(device.udid).to eq("a03b816861e89fac0a4da5884cb9d2f01bd5641e")
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe "#create" do
|
96
|
+
it "should create and return a new device" do
|
97
|
+
expect(client).to receive(:create_device!).with("Demo Device", "7f6c8dc83d77134b5a3a1c53f1202b395b04482b", mac: false).and_return({})
|
98
|
+
device = Spaceship::Device.create!(name: "Demo Device", udid: "7f6c8dc83d77134b5a3a1c53f1202b395b04482b")
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should fail to create a nil device UDID" do
|
102
|
+
expect do
|
103
|
+
Spaceship::Device.create!(name: "Demo Device", udid: nil)
|
104
|
+
end.to raise_error("You cannot create a device without a device_id (UDID) and name")
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should fail to create a nil device name" do
|
108
|
+
expect do
|
109
|
+
Spaceship::Device.create!(name: nil, udid: "7f6c8dc83d77134b5a3a1c53f1202b395b04482b")
|
110
|
+
end.to raise_error("You cannot create a device without a device_id (UDID) and name")
|
111
|
+
end
|
112
|
+
|
113
|
+
it "doesn't trigger an ITC call if the device ID is already registered" do
|
114
|
+
expect(client).to_not receive(:create_device!)
|
115
|
+
device = Spaceship::Device.create!(name: "Personal iPhone", udid: "e5814abb3b1d92087d48b64f375d8e7694932c39")
|
116
|
+
end
|
117
|
+
|
118
|
+
it "doesn't raise an exception if the device name is already registered" do
|
119
|
+
expect(client).to receive(:create_device!).with("Personal iPhone", "e5814abb3b1d92087d48b64f375d8e7694932c3c", mac: false).and_return({})
|
120
|
+
device = Spaceship::Device.create!(name: "Personal iPhone", udid: "e5814abb3b1d92087d48b64f375d8e7694932c3c")
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
describe "#disable" do
|
125
|
+
it "finds a device by its ID and disables it" do
|
126
|
+
device = Spaceship::Device.find("AAAAAAAAAA")
|
127
|
+
expect(device.status).to eq("c")
|
128
|
+
expect(device.enabled?).to eq(true)
|
129
|
+
device.disable!
|
130
|
+
expect(device.status).to eq("r")
|
131
|
+
expect(device.enabled?).to eq(false)
|
132
|
+
end
|
133
|
+
it "finds a device by its ID and enables it" do
|
134
|
+
device = Spaceship::Device.find("DISABLED_B", include_disabled: true)
|
135
|
+
expect(device.status).to eq("r")
|
136
|
+
expect(device.enabled?).to eq(false)
|
137
|
+
device.enable!
|
138
|
+
expect(device.status).to eq("c")
|
139
|
+
expect(device.enabled?).to eq(true)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|