samanage 2.1.19 → 2.1.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +224 -0
- data/Gemfile +12 -7
- data/Gemfile.lock +43 -24
- data/Guardfile +5 -3
- data/changelog.md +92 -19
- data/lib/samanage.rb +33 -30
- data/lib/samanage/api.rb +67 -74
- data/lib/samanage/api/attachments.rb +12 -12
- data/lib/samanage/api/category.rb +9 -7
- data/lib/samanage/api/changes.rb +17 -16
- data/lib/samanage/api/comments.rb +6 -7
- data/lib/samanage/api/contracts.rb +17 -17
- data/lib/samanage/api/custom_fields.rb +6 -6
- data/lib/samanage/api/custom_forms.rb +13 -10
- data/lib/samanage/api/departments.rb +9 -9
- data/lib/samanage/api/groups.rb +21 -20
- data/lib/samanage/api/hardwares.rb +14 -14
- data/lib/samanage/api/incidents.rb +7 -8
- data/lib/samanage/api/mobiles.rb +14 -15
- data/lib/samanage/api/other_assets.rb +14 -14
- data/lib/samanage/api/problems.rb +17 -17
- data/lib/samanage/api/purchase_orders.rb +17 -17
- data/lib/samanage/api/releases.rb +14 -14
- data/lib/samanage/api/requester.rb +4 -2
- data/lib/samanage/api/sites.rb +10 -9
- data/lib/samanage/api/solutions.rb +15 -14
- data/lib/samanage/api/tasks.rb +39 -0
- data/lib/samanage/api/time_tracks.rb +8 -6
- data/lib/samanage/api/users.rb +32 -30
- data/lib/samanage/api/utils.rb +11 -9
- data/lib/samanage/api/vendors.rb +14 -13
- data/lib/samanage/error.rb +5 -4
- data/lib/samanage/language.rb +48 -46
- data/lib/samanage/url_builder.rb +27 -25
- data/lib/samanage/utils.rb +10 -8
- data/lib/samanage/version.rb +1 -1
- data/samanage.gemspec +11 -9
- data/spec/api/samanage_attachment_spec.rb +20 -19
- data/spec/api/samanage_category_spec.rb +12 -10
- data/spec/api/samanage_change_spec.rb +47 -44
- data/spec/api/samanage_comments_spec.rb +12 -10
- data/spec/api/samanage_contract_spec.rb +41 -35
- data/spec/api/samanage_custom_field_spec.rb +7 -5
- data/spec/api/samanage_custom_form_spec.rb +11 -9
- data/spec/api/samanage_department_spec.rb +20 -15
- data/spec/api/samanage_group_spec.rb +30 -28
- data/spec/api/samanage_hardware_spec.rb +44 -38
- data/spec/api/samanage_incident_spec.rb +79 -61
- data/spec/api/samanage_mobile_spec.rb +39 -34
- data/spec/api/samanage_other_asset_spec.rb +50 -44
- data/spec/api/samanage_problem_spec.rb +53 -46
- data/spec/api/samanage_purchase_order_spec.rb +43 -40
- data/spec/api/samanage_release_spec.rb +44 -40
- data/spec/api/samanage_site_spec.rb +18 -16
- data/spec/api/samanage_solution_spec.rb +16 -14
- data/spec/api/samanage_task_spec.rb +68 -0
- data/spec/api/samanage_time_tracks_spec.rb +41 -27
- data/spec/api/samanage_user_spec.rb +51 -46
- data/spec/api/samanage_util_spec.rb +13 -11
- data/spec/api/samanage_vendors_spec.rb +18 -16
- data/spec/samanage_api_spec.rb +27 -23
- data/spec/samanage_category_spec.rb +10 -8
- data/spec/samanage_language_spec.rb +12 -10
- data/spec/samanage_url_builder_spec.rb +11 -9
- data/spec/spec_helper.rb +6 -4
- metadata +5 -2
data/samanage.gemspec
CHANGED
@@ -1,19 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
$:.push File.expand_path("../lib", __FILE__)
|
2
|
-
require
|
4
|
+
require "samanage"
|
3
5
|
|
4
6
|
Gem::Specification.new do |s|
|
5
|
-
s.name =
|
7
|
+
s.name = "samanage"
|
6
8
|
s.version = Samanage::VERSION
|
7
9
|
s.date = Date.today.strftime("%Y-%m-%d")
|
8
10
|
s.summary = "Samanage Ruby Gem"
|
9
11
|
s.description = "Connect to Samanage using Ruby!"
|
10
12
|
s.authors = ["Chris Walls"]
|
11
|
-
s.email =
|
13
|
+
s.email = "cwalls2908@gmail.com"
|
12
14
|
s.files = `git ls-files`.split("\n")
|
13
|
-
s.homepage =
|
14
|
-
s.license =
|
15
|
+
s.homepage = "https://github.com/cw2908/samanage-ruby"
|
16
|
+
s.license = "MIT"
|
15
17
|
s.require_paths = ["lib"]
|
16
|
-
s.required_ruby_version =
|
17
|
-
s.add_development_dependency
|
18
|
-
s.add_runtime_dependency
|
19
|
-
end
|
18
|
+
s.required_ruby_version = ">= 2.3"
|
19
|
+
s.add_development_dependency "httparty", ["0.16.4"]
|
20
|
+
s.add_runtime_dependency "httparty", ["0.16.4"]
|
21
|
+
end
|
@@ -1,43 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
|
-
require
|
3
|
+
require "samanage"
|
3
4
|
describe Samanage::Api do
|
4
|
-
context
|
5
|
-
describe
|
6
|
-
before(:all) do
|
7
|
-
TOKEN ||= ENV[
|
5
|
+
context "Attachments" do
|
6
|
+
describe "API Functions" do
|
7
|
+
before(:all) do
|
8
|
+
TOKEN ||= ENV["SAMANAGE_TEST_API_TOKEN"]
|
8
9
|
@samanage = Samanage::Api.new(token: TOKEN)
|
9
10
|
@users = @samanage.get_users[:data]
|
10
11
|
@incidents = @samanage.incidents
|
11
12
|
end
|
12
|
-
it
|
13
|
-
filename =
|
13
|
+
it "uploads an attachment" do
|
14
|
+
filename = "sample_file.txt"
|
14
15
|
filepath = File.join(Dir.pwd, filename)
|
15
|
-
incident_id = @incidents.sample.dig(
|
16
|
+
incident_id = @incidents.sample.dig("id")
|
16
17
|
attach = @samanage.create_attachment(
|
17
18
|
filepath: filepath,
|
18
19
|
attachable_id: incident_id,
|
19
|
-
attachable_type:
|
20
|
+
attachable_type: "Incident"
|
20
21
|
)
|
21
22
|
expect(attach[:code]).to eq(200).or(201)
|
22
|
-
expect(filename).to eq(attach[:data][
|
23
|
-
expect(File.open(filepath).size).to eq(attach[:data][
|
23
|
+
expect(filename).to eq(attach[:data]["filename"])
|
24
|
+
expect(File.open(filepath).size).to eq(attach[:data]["size"])
|
24
25
|
end
|
25
|
-
it
|
26
|
-
incident_id = @incidents.sample.dig(
|
27
|
-
filename =
|
26
|
+
it "downloads an attachment" do
|
27
|
+
incident_id = @incidents.sample.dig("id")
|
28
|
+
filename = "sample_file.txt"
|
28
29
|
filepath = File.join(Dir.pwd, filename)
|
29
30
|
attach = @samanage.create_attachment(
|
30
31
|
filepath: filepath,
|
31
32
|
attachable_id: incident_id,
|
32
|
-
attachable_type:
|
33
|
+
attachable_type: "Incident"
|
33
34
|
)
|
34
35
|
expect(attach[:code]).to eq(200).or(201)
|
35
36
|
attachable_incident_id = incident_id # Need filter for has attachment?
|
36
|
-
incident = @samanage.find_incident(id: attachable_incident_id, options: {layout:
|
37
|
-
attachment = @samanage.download_attachment(attachment: incident[:data][
|
37
|
+
incident = @samanage.find_incident(id: attachable_incident_id, options: { layout: "long" })
|
38
|
+
attachment = @samanage.download_attachment(attachment: incident[:data]["attachments"].first)
|
38
39
|
expect(attachment.class).to be(File)
|
39
|
-
expect(attachment.path.split(
|
40
|
+
expect(attachment.path.split("/").last).to eq(filename)
|
40
41
|
end
|
41
42
|
end
|
42
43
|
end
|
43
|
-
end
|
44
|
+
end
|
@@ -1,18 +1,20 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "samanage"
|
2
4
|
describe Samanage::Api do
|
3
|
-
context
|
5
|
+
context "category" do
|
4
6
|
before(:all) do
|
5
|
-
TOKEN ||= ENV[
|
7
|
+
TOKEN ||= ENV["SAMANAGE_TEST_API_TOKEN"]
|
6
8
|
@samanage = Samanage::Api.new(token: TOKEN)
|
7
9
|
@categories = @samanage.categories
|
8
10
|
end
|
9
|
-
it
|
11
|
+
it "collects all categories" do
|
10
12
|
expect(@categories).to be_an(Array)
|
11
13
|
end
|
12
14
|
|
13
|
-
it
|
14
|
-
category_name = "Category Name ##{(rand*10**4).ceil}"
|
15
|
-
category_description = "Descrption #{(rand*10**4).ceil}"
|
15
|
+
it "creates a category" do
|
16
|
+
category_name = "Category Name ##{(rand * 10**4).ceil}"
|
17
|
+
category_description = "Descrption #{(rand * 10**4).ceil}"
|
16
18
|
payload = {
|
17
19
|
category: {
|
18
20
|
name: category_name,
|
@@ -21,9 +23,9 @@ describe Samanage::Api do
|
|
21
23
|
}
|
22
24
|
category_create = @samanage.create_category(payload: payload)
|
23
25
|
|
24
|
-
expect(category_create[:data][
|
25
|
-
expect(category_create[:data][
|
26
|
+
expect(category_create[:data]["id"]).to be_an(Integer)
|
27
|
+
expect(category_create[:data]["name"]).to eq(category_name)
|
26
28
|
expect(category_create[:code]).to eq(200).or(201)
|
27
29
|
end
|
28
30
|
end
|
29
|
-
end
|
31
|
+
end
|
@@ -1,81 +1,84 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "samanage"
|
2
4
|
describe Samanage::Api do
|
3
|
-
context
|
4
|
-
describe
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
it
|
5
|
+
context "changes" do
|
6
|
+
describe "API Functions" do
|
7
|
+
before(:all) do
|
8
|
+
TOKEN ||= ENV["SAMANAGE_TEST_API_TOKEN"]
|
9
|
+
@samanage = Samanage::Api.new(token: TOKEN)
|
10
|
+
@changes = @samanage.changes
|
11
|
+
@users = @samanage.get_users[:data]
|
12
|
+
end
|
13
|
+
it "get_changes: it returns API call of changes" do
|
12
14
|
api_call = @samanage.get_changes
|
13
15
|
expect(api_call).to be_a(Hash)
|
14
16
|
expect(api_call[:total_count]).to be_an(Integer)
|
15
17
|
expect(api_call).to have_key(:response)
|
16
18
|
expect(api_call).to have_key(:code)
|
17
19
|
end
|
18
|
-
it
|
20
|
+
it "collect_changes: collects array of changes" do
|
19
21
|
change_count = @samanage.get_changes[:total_count]
|
20
22
|
@changes = @samanage.changes
|
21
23
|
expect(@changes).to be_an(Array)
|
22
24
|
expect(@changes.size).to eq(change_count)
|
23
25
|
end
|
24
|
-
it
|
25
|
-
users_email = @samanage.collect_users.sample[
|
26
|
+
it "create_change(payload: json): creates a change" do
|
27
|
+
users_email = @samanage.collect_users.sample["email"]
|
26
28
|
change_name = "Samanage Ruby change"
|
27
29
|
json = {
|
28
30
|
change: {
|
29
|
-
requester: {email: users_email},
|
31
|
+
requester: { email: users_email },
|
30
32
|
name: change_name,
|
31
|
-
priority:
|
33
|
+
priority: "Low",
|
32
34
|
description: "Description"
|
33
35
|
}
|
34
36
|
}
|
35
37
|
change_create = @samanage.create_change(payload: json)
|
36
38
|
|
37
|
-
expect(change_create[:data][
|
38
|
-
expect(change_create[:data][
|
39
|
+
expect(change_create[:data]["id"]).to be_an(Integer)
|
40
|
+
expect(change_create[:data]["name"]).to eq(change_name)
|
39
41
|
expect(change_create[:code]).to eq(200).or(201)
|
40
42
|
end
|
41
|
-
it
|
42
|
-
users_email = @users.sample[
|
43
|
+
it "create_change: fails if no name/title" do
|
44
|
+
users_email = @users.sample["email"]
|
43
45
|
json = {
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
46
|
+
change: {
|
47
|
+
requester: { email: users_email },
|
48
|
+
description: "Description"
|
47
49
|
}
|
48
50
|
}
|
49
|
-
expect{@samanage.create_change(payload: json)}.to raise_error(Samanage::InvalidRequest)
|
51
|
+
expect { @samanage.create_change(payload: json) }.to raise_error(Samanage::InvalidRequest)
|
50
52
|
end
|
51
|
-
it
|
52
|
-
sample_id = @changes.sample[
|
53
|
+
it "find_change: returns a change card by known id" do
|
54
|
+
sample_id = @changes.sample["id"]
|
53
55
|
change = @samanage.find_change(id: sample_id)
|
54
|
-
expect(change[:data][
|
55
|
-
expect(change[:data]).to have_key(
|
56
|
-
expect(change[:data]).to have_key(
|
57
|
-
expect(change[:data]).to have_key(
|
56
|
+
expect(change[:data]["id"]).to eq(sample_id) # id should match found change
|
57
|
+
expect(change[:data]).to have_key("name")
|
58
|
+
expect(change[:data]).to have_key("requester")
|
59
|
+
expect(change[:data]).to have_key("id")
|
58
60
|
end
|
59
|
-
it
|
60
|
-
sample_id = @changes.sample[
|
61
|
+
it "find_change: returns more keys with layout=long" do
|
62
|
+
sample_id = @changes.sample["id"]
|
61
63
|
layout_regular_change = @samanage.find_change(id: sample_id)
|
62
|
-
layout_long_change = @samanage.find_change(id: sample_id, options: {layout:
|
64
|
+
layout_long_change = @samanage.find_change(id: sample_id, options: { layout: "long" })
|
63
65
|
|
64
|
-
expect(layout_long_change[:data][
|
66
|
+
expect(layout_long_change[:data]["id"]).to eq(sample_id) # id should match found change
|
65
67
|
expect(layout_long_change[:data].keys.size).to be > (layout_regular_change.keys.size)
|
66
68
|
expect(layout_long_change[:data].keys - layout_regular_change[:data].keys).to_not be([])
|
67
69
|
end
|
68
|
-
it
|
70
|
+
it "find_change: returns nothing for an invalid id" do
|
69
71
|
sample_id = (0..10).entries.sample
|
70
|
-
|
72
|
+
# id should match found change
|
73
|
+
expect { @samanage.find_change(id: sample_id) }.to raise_error(Samanage::NotFound)
|
71
74
|
end
|
72
|
-
it
|
73
|
-
sample_change = @changes.reject{|i| [
|
74
|
-
sample_id = sample_change[
|
75
|
-
description = (0...500).map { (
|
75
|
+
it "update_change: update_change by id" do
|
76
|
+
sample_change = @changes.reject { |i| ["Closed", "Resolved"].include? i["state"] }.sample
|
77
|
+
sample_id = sample_change["id"]
|
78
|
+
description = (0...500).map { ("a".."z").to_a[rand(26)] }.join
|
76
79
|
change_json = {
|
77
|
-
:
|
78
|
-
:
|
80
|
+
change: {
|
81
|
+
description: description
|
79
82
|
}
|
80
83
|
}
|
81
84
|
change_update = @samanage.update_change(payload: change_json, id: sample_id)
|
@@ -83,12 +86,12 @@ describe Samanage::Api do
|
|
83
86
|
expect(change_update[:code]).to eq(200).or(201)
|
84
87
|
end
|
85
88
|
it 'finds more data for option[:layout] = "long"' do
|
86
|
-
full_layout_change_keys = @samanage.changes(options: {layout:
|
89
|
+
full_layout_change_keys = @samanage.changes(options: { layout: "long" }).first.keys
|
87
90
|
basic_change_keys = @samanage.changes.sample.keys
|
88
91
|
expect(basic_change_keys.size).to be < full_layout_change_keys.size
|
89
92
|
end
|
90
|
-
it
|
91
|
-
sample_change_id = @changes.sample[
|
93
|
+
it "deletes a valid change" do
|
94
|
+
sample_change_id = @changes.sample["id"]
|
92
95
|
change_delete = @samanage.delete_change(id: sample_change_id)
|
93
96
|
expect(change_delete[:code]).to eq(200).or(201)
|
94
97
|
end
|
@@ -1,21 +1,23 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "samanage"
|
2
4
|
describe Samanage::Api do
|
3
|
-
context
|
5
|
+
context "Comments" do
|
4
6
|
before(:all) do
|
5
|
-
TOKEN ||= ENV[
|
7
|
+
TOKEN ||= ENV["SAMANAGE_TEST_API_TOKEN"]
|
6
8
|
@samanage = Samanage::Api.new(token: TOKEN)
|
7
9
|
@incidents = @samanage.get_incidents[:data]
|
8
10
|
end
|
9
|
-
describe
|
10
|
-
it
|
11
|
-
incident_id = @incidents.sample.dig(
|
11
|
+
describe "API Functions" do
|
12
|
+
it "gets comments" do
|
13
|
+
incident_id = @incidents.sample.dig("id")
|
12
14
|
comments = @samanage.get_comments(incident_id: incident_id)
|
13
15
|
expect(comments).to be_a(Hash)
|
14
16
|
end
|
15
17
|
|
16
|
-
it
|
17
|
-
incident_id = @incidents.sample.dig(
|
18
|
-
rand_text = (
|
18
|
+
it "creates a comment" do
|
19
|
+
incident_id = @incidents.sample.dig("id")
|
20
|
+
rand_text = ("a".."z").to_a.shuffle[0, 8].join
|
19
21
|
comment = {
|
20
22
|
comment: {
|
21
23
|
body: rand_text,
|
@@ -23,7 +25,7 @@ describe Samanage::Api do
|
|
23
25
|
}
|
24
26
|
api_call = @samanage.create_comment(incident_id: incident_id, comment: comment)
|
25
27
|
|
26
|
-
expect(api_call.dig(:data,
|
28
|
+
expect(api_call.dig(:data, "body")).to eq(rand_text)
|
27
29
|
end
|
28
30
|
end
|
29
31
|
end
|
@@ -1,66 +1,72 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "samanage"
|
2
4
|
|
3
5
|
describe Samanage::Api do
|
4
|
-
context
|
5
|
-
describe
|
6
|
-
before(:all) do
|
7
|
-
TOKEN ||= ENV[
|
6
|
+
context "Contract" do
|
7
|
+
describe "API Fucntions" do
|
8
|
+
before(:all) do
|
9
|
+
TOKEN ||= ENV["SAMANAGE_TEST_API_TOKEN"]
|
8
10
|
@samanage = Samanage::Api.new(token: TOKEN)
|
9
11
|
@contracts = @samanage.contracts
|
10
12
|
end
|
11
|
-
it
|
13
|
+
it "get_contracts: it returns API call of contracts" do
|
12
14
|
api_call = @samanage.get_contracts
|
13
15
|
expect(api_call).to be_a(Hash)
|
14
16
|
expect(api_call[:total_count]).to be_an(Integer)
|
15
17
|
expect(api_call).to have_key(:response)
|
16
18
|
expect(api_call).to have_key(:code)
|
17
19
|
end
|
18
|
-
it
|
20
|
+
it "collect_contracts: collects array of contracts" do
|
19
21
|
contract_count = @samanage.get_contracts[:total_count]
|
20
22
|
expect(@contracts).to be_an(Array)
|
21
23
|
expect(@contracts.size).to eq(contract_count)
|
22
24
|
end
|
23
|
-
it
|
25
|
+
it "create_contract(payload: json): creates a contract" do
|
24
26
|
random_name = Faker::Artist.name
|
25
27
|
json = {
|
26
28
|
contract: {
|
27
|
-
type:
|
28
|
-
manufacturer_name:
|
29
|
-
status:
|
29
|
+
type: "SoftwareLicense",
|
30
|
+
manufacturer_name: "Adobe",
|
31
|
+
status: "Active",
|
30
32
|
name: random_name,
|
31
33
|
}
|
32
34
|
}
|
33
35
|
contract_create = @samanage.create_contract(payload: json)
|
34
36
|
|
35
|
-
expect(contract_create[:data][
|
36
|
-
expect(contract_create[:data][
|
37
|
+
expect(contract_create[:data]["id"]).to be_an(Integer)
|
38
|
+
expect(contract_create[:data]["name"]).to eq(random_name)
|
37
39
|
end
|
38
|
-
it
|
40
|
+
it "create_contract: fails if no status" do
|
39
41
|
contract_name = Faker::Ancient.god
|
40
42
|
json = {
|
41
|
-
:
|
42
|
-
model:
|
43
|
+
contract: {
|
44
|
+
model: "test",
|
43
45
|
manufacturer_name: contract_name,
|
44
46
|
}
|
45
47
|
}
|
46
|
-
expect{
|
48
|
+
expect {
|
49
|
+
@samanage.create_contract(payload: json)
|
50
|
+
}.to raise_error(Samanage::InvalidRequest)
|
47
51
|
end
|
48
|
-
it
|
49
|
-
sample_id = @contracts.sample[
|
52
|
+
it "find_contract: returns a contract card by known id" do
|
53
|
+
sample_id = @contracts.sample["id"]
|
50
54
|
contract = @samanage.find_contract(id: sample_id)
|
51
55
|
|
52
|
-
expect(contract[:data][
|
53
|
-
expect(contract[:data]).to have_key(
|
54
|
-
expect(contract[:data]).to have_key(
|
55
|
-
expect(contract[:data]).to have_key(
|
56
|
+
expect(contract[:data]["id"]).to eq(sample_id) # id should match found contract
|
57
|
+
expect(contract[:data]).to have_key("manufacturer_name")
|
58
|
+
expect(contract[:data]).to have_key("name")
|
59
|
+
expect(contract[:data]).to have_key("id")
|
56
60
|
end
|
57
|
-
it
|
61
|
+
it "find_contract: returns nothing for an invalid id" do
|
58
62
|
sample_id = (0..10).entries.sample
|
59
|
-
expect{
|
63
|
+
expect {
|
64
|
+
@samanage.find_contract(id: sample_id)
|
65
|
+
}.to raise_error(Samanage::NotFound) # id should match found contract
|
60
66
|
end
|
61
|
-
it
|
62
|
-
sample_id = @contracts.sample[
|
63
|
-
new_name = Faker::Company.name
|
67
|
+
it "update_contract: update_contract by id" do
|
68
|
+
sample_id = @contracts.sample["id"]
|
69
|
+
new_name = Faker::Company.name
|
64
70
|
json = {
|
65
71
|
contract: {
|
66
72
|
manufacturer_name: new_name
|
@@ -70,12 +76,12 @@ describe Samanage::Api do
|
|
70
76
|
expect(contract_update[:data]["manufacturer_name"]).to eq(new_name)
|
71
77
|
expect(contract_update[:code]).to eq(200).or(201)
|
72
78
|
end
|
73
|
-
it
|
74
|
-
sample_id = @contracts.sample[
|
79
|
+
it "adds an item to a contract by id" do
|
80
|
+
sample_id = @contracts.sample["id"]
|
75
81
|
item = {
|
76
82
|
item: {
|
77
|
-
name: Faker::Company.catch_phrase
|
78
|
-
version:" 123",
|
83
|
+
name: Faker::Company.catch_phrase,
|
84
|
+
version: " 123",
|
79
85
|
qty: "2",
|
80
86
|
tag: Faker::Company.profession,
|
81
87
|
}
|
@@ -83,11 +89,11 @@ describe Samanage::Api do
|
|
83
89
|
add_item = @samanage.add_item_to_contract(id: sample_id, payload: item)
|
84
90
|
expect(add_item[:code]).to eq(200).or(201)
|
85
91
|
end
|
86
|
-
it
|
87
|
-
sample_contract_id = @contracts.sample[
|
92
|
+
it "deletes a valid contract" do
|
93
|
+
sample_contract_id = @contracts.sample["id"]
|
88
94
|
contract_delete = @samanage.delete_contract(id: sample_contract_id)
|
89
95
|
expect(contract_delete[:code]).to eq(200).or(201)
|
90
96
|
end
|
91
97
|
end
|
92
98
|
end
|
93
|
-
end
|
99
|
+
end
|