|
101 | 101 | it { expect { @instance.patch_client('', nil) }.to raise_error 'Must specify a client id' }
|
102 | 102 | it { expect { @instance.patch_client('some', nil) }.to raise_error 'Must specify a valid body' }
|
103 | 103 | end
|
| 104 | + |
| 105 | + context '.create_client_credentials' do |
| 106 | + it { expect(@instance).to respond_to(:create_client_credentials) } |
| 107 | + |
| 108 | + it 'is expected to send post to /api/v2/clients/1/credentials' do |
| 109 | + payload = { credential_type: 'public_key', name: 'my credentials', pem: '' } |
| 110 | + |
| 111 | + expect(@instance).to receive(:post).with('/api/v2/clients/1/credentials', payload) |
| 112 | + expect { @instance.create_client_credentials('1', payload) }.not_to raise_error |
| 113 | + end |
| 114 | + |
| 115 | + it { expect { @instance.create_client_credentials('', nil) }.to raise_error 'Must specify a client id' } |
| 116 | + it { expect { @instance.create_client_credentials('1', nil) }.to raise_error 'Must specify a valid body' } |
| 117 | + end |
| 118 | + |
| 119 | + context '.client_credentials' do |
| 120 | + it { expect(@instance).to respond_to(:client_credentials) } |
| 121 | + it { expect(@instance).to respond_to(:get_client_credentials) } |
| 122 | + |
| 123 | + it 'is expected to send get to /api/v2/clients/1/credentials' do |
| 124 | + expect(@instance).to receive(:get).with('/api/v2/clients/1/credentials') |
| 125 | + expect { @instance.client_credentials('1') }.not_to raise_error |
| 126 | + end |
| 127 | + |
| 128 | + it { expect { @instance.client_credentials('') }.to raise_error 'Must specify a client id' } |
| 129 | + end |
| 130 | + |
| 131 | + context '.client_credential' do |
| 132 | + it { expect(@instance).to respond_to(:client_credential) } |
| 133 | + it { expect(@instance).to respond_to(:get_client_credential) } |
| 134 | + |
| 135 | + it 'is expected to send get to /api/v2/clients/1/credentials/2' do |
| 136 | + expect(@instance).to receive(:get).with('/api/v2/clients/1/credentials/2') |
| 137 | + expect { @instance.client_credential('1', '2') }.not_to raise_error |
| 138 | + end |
| 139 | + |
| 140 | + it { expect { @instance.client_credential('', '') }.to raise_error 'Must specify a client id' } |
| 141 | + it { expect { @instance.client_credential('1', '') }.to raise_error 'Must specify a credential id' } |
| 142 | + end |
| 143 | + |
| 144 | + context '.delete_client_credential', focus: true do |
| 145 | + it { expect(@instance).to respond_to(:delete_client_credential) } |
| 146 | + |
| 147 | + it 'is expected to delete /api/v2/clients/1/credentials/2' do |
| 148 | + expect(@instance).to receive(:delete).with('/api/v2/clients/1/credentials/2') |
| 149 | + expect { @instance.delete_client_credential('1', '2') }.not_to raise_error |
| 150 | + end |
| 151 | + |
| 152 | + it { expect { @instance.delete_client_credential('', '') }.to raise_error 'Must specify a client id' } |
| 153 | + it { expect { @instance.delete_client_credential('1', '') }.to raise_error 'Must specify a credential id' } |
| 154 | + end |
104 | 155 | end
|
0 commit comments