apireaper 1.0.2 → 1.0.3
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/apireaper/cli.rb +2 -1
- data/lib/apireaper/version.rb +1 -1
- data/spec/apireaper/requester_spec.rb +73 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0d9292818540aacf4fdefbf8056dc33d8a78377
|
4
|
+
data.tar.gz: 0d6b6b0a1b5ecd4a7cc588b477e981497ae0b896
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 505b5085c1481b2e6dba040533564c3838793829c17e3d440421e74522573c74df3c7dd8619f33db4ff0de6cbc5836b621372a2e92ab732efb673dfa2c5a62bb
|
7
|
+
data.tar.gz: ddfee6972c6b8f097a735fdf31af8ecb00f0845c2e85a457c3f477f96958fc8e659a5160f90cc925c2c5c1dc4a77bf88fa673ffdb1783b371700e9063220121a
|
data/lib/apireaper/cli.rb
CHANGED
data/lib/apireaper/version.rb
CHANGED
@@ -0,0 +1,73 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2017 Richard Delaplace, Vente-Privee.Com
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'spec_helper'
|
18
|
+
|
19
|
+
def print_out(code)
|
20
|
+
case code
|
21
|
+
when 200, 201, 202
|
22
|
+
"Response code is valid: #{code}\n" \
|
23
|
+
"Response body is valid\n" \
|
24
|
+
"All checks passed\n"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe APIReaper::Requester do # rubocop:disable Metrics/BlockLength
|
29
|
+
%w[delete get put].each do |method|
|
30
|
+
context "check #{method} http://api.test.yueyehua.net/ -q" do
|
31
|
+
it 'tries unimplemented commands.' do
|
32
|
+
expect { start(self) }.to raise_error(SystemExit)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'check notexistingcmd http://api.test.yueyehua.net/ -q' do
|
38
|
+
it 'tries unimplemented commands.' do
|
39
|
+
expect { start(self) }.to raise_error(SystemExit)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'check post http://api.test.yueyehua.net/' do
|
44
|
+
it 'requests an API without extra arguments.' do
|
45
|
+
expect { start(self) }.to output(print_out(200)).to_stdout
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'check post http://api.test.yueyehua.net/ -h k:v' do
|
50
|
+
it 'requests an API with headers.' do
|
51
|
+
expect { start(self) }.to output(print_out(201)).to_stdout
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'check post http://api.test.yueyehua.net/ -d 3wfk=3wfv' do
|
56
|
+
it 'requests an API with www_form type datas.' do
|
57
|
+
expect { start(self) }.to output(print_out(202)).to_stdout
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
opts202 = '-d "{\"jsonk\":\"jsonv\"}" -h Content-type:application/json'
|
62
|
+
context "check post http://api.test.yueyehua.net/ #{opts202}" do
|
63
|
+
it 'requests an API with json type datas.' do
|
64
|
+
expect { start(self) }.to output(print_out(203)).to_stdout
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context 'check post http://api.test.yueyehua.net/ -d k@v&l:w' do
|
69
|
+
it 'requests an API with wrong type of datas.' do
|
70
|
+
expect { start(self) }.to raise_error(SystemExit)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apireaper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Delaplace
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- lib/apireaper/version.rb
|
148
148
|
- spec/apireaper/checker_spec.rb
|
149
149
|
- spec/apireaper/cli_spec.rb
|
150
|
+
- spec/apireaper/requester_spec.rb
|
150
151
|
- spec/apireaper/stubs/servers_stubs.rb
|
151
152
|
- spec/apireaper_spec.rb
|
152
153
|
- spec/files/body
|