kanoah_ruby 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7938f3bcc54c23d4f2e4b96508319e64038773d0
4
+ data.tar.gz: 04d70849e12414673a1abc10dfe1189767187c20
5
+ SHA512:
6
+ metadata.gz: 49849bf9958262b0292a33089bbaa2bfa728af50a86f2bd94c96a22fbe77cd5077c0599723be0073944cc72c6b1d70ad13fac97f28a68e59ca9d9bd6050935fb
7
+ data.tar.gz: 18e1fe533b2418126adafea5e0f860dc0006bdcd0183be896e5a2371c56586eb79c8028b7136e4ac46d0b7a3521b6fc157d16b28b913d08506240a933e842a26
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT LICENSE
2
+
3
+ Copyright (c) Justin Commu <Justin.Commu@loblaw.ca>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Kanoah Ruby (API Wrapper)
2
+
3
+ Welcome to kanoah_ruby, a ruby API wrapper for Kanoah to help you create formatters and interactions with Kanoah!
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'kanoah_ruby'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install kanoah_ruby_
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Development
26
+
27
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/test. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
32
+
33
+
34
+ ## License
35
+
36
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
37
+
data/lib/client.rb ADDED
@@ -0,0 +1,32 @@
1
+ module Kanoah
2
+ class Client
3
+ include HTTParty
4
+
5
+ include Kanoah::Services::Authentication
6
+ include Kanoah::Services::IssueLink
7
+ include Kanoah::Services::TestCase
8
+ include Kanoah::Services::TestPlan
9
+ include Kanoah::Services::TestResult
10
+ include Kanoah::Services::TestRun
11
+
12
+ default_options.update(verify: false)
13
+ format :json
14
+ attr_reader :environment, :test_run_id, :project
15
+
16
+
17
+ def initialize(options={})
18
+ self.class.base_uri options.fetch(:base_url) { Kanoah.config.base_url }
19
+ @environment = options.fetch(:environment)
20
+ @test_run_id = options.fetch(:test_run_id) { nil }
21
+ @project_id = options.fetch(:project_id)
22
+ token = Base64.encode64(options.fetch(:username)+':'+options.fetch(:password))
23
+ set_access_token(token[0..-2])
24
+ end
25
+
26
+ def set_access_token(token)
27
+ @header = { "Authorization" => "Basic #{token}", "Content-Type" => "application/json"}
28
+ end
29
+
30
+ end
31
+ end
32
+
@@ -0,0 +1,20 @@
1
+ module Kanoah
2
+
3
+ class << self
4
+ attr_accessor :config
5
+ end
6
+
7
+ def self.configure
8
+ self.config ||= Configuration.new
9
+ yield(config)
10
+ end
11
+
12
+ class Configuration
13
+ attr_accessor :base_url
14
+
15
+ def initialize
16
+ @base_url = nil
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,13 @@
1
+ require 'httparty'
2
+ require 'base64'
3
+
4
+ require_relative 'configuration'
5
+
6
+ require_relative 'services/authentication'
7
+ require_relative 'services/issue_link'
8
+ require_relative 'services/test_case'
9
+ require_relative 'services/test_plan'
10
+ require_relative 'services/test_result'
11
+ require_relative 'services/test_run'
12
+
13
+ require_relative 'client'
@@ -0,0 +1,13 @@
1
+ module Kanoah
2
+ module Services
3
+ module Authentication
4
+
5
+ def login(username, password)
6
+ @response = self.class.post('/rest/auth/1/session', body: {'username' => username, 'password' => password}.to_json, headers: {"Content-Type" => "application/json"})
7
+ #set_access_token(@response['session']['name'] +'='+@response['session']['value'])
8
+ self
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ module Kanoah
2
+ module Services
3
+ module IssueLink
4
+
5
+ def get_linked_tests(issue_key)
6
+ @response = self.class.get("/rest/kanoahtests/1.0/issuelink/#{issue_key}/testcases", headers: @header)
7
+ self
8
+ end
9
+
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,22 @@
1
+ module Kanoah
2
+ module Services
3
+ module TestCase
4
+
5
+ def post_new_test_case(body)
6
+ @response = self.class.post("/rest/kanoahtests/1.0/testcase", body: body.to_json, headers: @header)
7
+ self
8
+ end
9
+
10
+ def get_test_case_details(test_case_key)
11
+ @response = self.class.get("/rest/kanoahtests/1.0/testcase/#{test_case_key}", headers: @header)
12
+ self
13
+ end
14
+
15
+ def search_test_cases(query_string)
16
+ @response = self.calss.get("/rest/kanoahtests/1.0/testcase/search", headers: @header, query: {query: query_string})
17
+ self
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,12 @@
1
+ module Kanoah
2
+ module Services
3
+ module TestPlan
4
+
5
+ def get_plan_details(test_plan_key)
6
+ @response = self.class.get("/rest/kanoahtests/1.0/testplan/#{test_plan_key}", headers: @header)
7
+ self
8
+ end
9
+
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ module Kanoah
2
+ module Services
3
+ module TestResult
4
+
5
+ def post_new_result(scenario)
6
+ @response = self.class.post("/rest/kanoahtests/1.0/testresult",
7
+ body: { 'projectKey' => @project_id, 'testCaseKey'=> scenario[:test_case] ,'status' => scenario[:status],
8
+ 'environment' => @environment, 'comment' => scenario[:comment], 'executionTime' => scenario[:execution_time], 'scriptResults' => scenario[:script_results]}.to_json,
9
+ headers: @header)
10
+ self
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,29 @@
1
+ module Kanoah
2
+ module Services
3
+ module TestRun
4
+
5
+ def post_new_test_run(body)
6
+ @response = self.class.post("/rest/kanoahtests/1.0/testrun", body: body.to_json, headers: @header)
7
+ self
8
+ end
9
+
10
+ def get_run_details(test_run_key)
11
+ @response = self.class.get("/rest/hkanoahtests/1.0/testrun/#{test_run_key}", headers: @header)
12
+ self
13
+ end
14
+
15
+ def post_new_result_to_run(scenario)
16
+ @response = self.class.post("/rest/kanoahtests/1.0/testrun/#{@test_run_id}/testcase/#{scenario[:test_case]}/testresult",
17
+ body: { 'status' => scenario[:status], 'environment' => @environment, 'comment' => scenario[:comment], 'executionTime' => scenario[:execution_time], 'scriptResults' => scenario[:script_results]}.to_json,
18
+ headers: @header)
19
+ self
20
+ end
21
+
22
+ def update_result_of_run(test_run_key, test_case_key, body)
23
+ @response = self.class.put("/rest/kanoahtests/1.0/testrun/#{test_run_key}/testcase/#{test_case_key}/testresult", body: body.to_json, headers: @header)
24
+ self
25
+ end
26
+
27
+ end
28
+ end
29
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kanoah_ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Automation Wizards
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-02-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.13.7
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.13.7
27
+ description: Use this library to interact with the Kanoah API in Ruby
28
+ email:
29
+ - Justin.Commu@loblaw.ca
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - LICENSE
35
+ - README.md
36
+ - lib/client.rb
37
+ - lib/configuration.rb
38
+ - lib/kanoah_ruby.rb
39
+ - lib/services/authentication.rb
40
+ - lib/services/issue_link.rb
41
+ - lib/services/test_case.rb
42
+ - lib/services/test_plan.rb
43
+ - lib/services/test_result.rb
44
+ - lib/services/test_run.rb
45
+ homepage: https://loblawdigital.ca
46
+ licenses:
47
+ - MIT
48
+ metadata: {}
49
+ post_install_message:
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ requirements: []
64
+ rubyforge_project:
65
+ rubygems_version: 2.6.7
66
+ signing_key:
67
+ specification_version: 4
68
+ summary: Ruby wrapper for the Kanoah API
69
+ test_files: []