pact-mock_service 3.4.0 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e2f124e5c5dcc30b7da04339d08060ebff78da1ea42124b70e38bb8dc9640e2
4
- data.tar.gz: d3bd8504db25fe694049c4781afa05475ec685650be7f95a731b89a3cdb7e86e
3
+ metadata.gz: '07408e9dcc7fd09a8e3e9f99b818e9bf7c49a7b8dbc72b3a3e73b2c0d17086ef'
4
+ data.tar.gz: 9724d49997cce5add29605eae25ec3ed81f7ca3fea3c1eebb6e7a682e481d119
5
5
  SHA512:
6
- metadata.gz: 4ddbe4e7896061f66dde24509fe19530cf2a3da38f74d1bf1c87631c383c73a774cec603cc4df2d4b8c1a9d3d5189fc2ab04ce4dec53eb61cb47c5c0c6648dfa
7
- data.tar.gz: 322eb829df216e995d2d763260f81b87ee302696fa1195b9f6a6a14208d44de346b26e08d626c62ac511ddd696a941dc7bfe2942e3b0aa36a2b54727acce80a9
6
+ metadata.gz: 930ed339b550585517905bec02d6bee7c2f2f32892303934ceab41612f6c499d86730588d48b3c90fb5fd248baa1ad612c48d9a8d49e6ea5c8228f08a010cd0a
7
+ data.tar.gz: 8615335a96895ac305a554632c5ddf28aca9c73b8ddd9a6c9bcaf23888d6b832e43034993abc40dbf27c93e2a7c868746c54db8e61d153accc4a83d06141ddfe
@@ -1,3 +1,12 @@
1
+ <a name="v3.5.0"></a>
2
+ ### v3.5.0 (2020-01-17)
3
+
4
+
5
+ #### Features
6
+
7
+ * add token, username and password options to stub service (#118) ([76236d8](/../../commit/76236d8))
8
+
9
+
1
10
  <a name="v3.3.1"></a>
2
11
  ### v3.3.1 (2020-01-16)
3
12
 
@@ -17,6 +17,7 @@ module Pact
17
17
  class App
18
18
  def initialize options = {}
19
19
  logger = Logger.from_options(options)
20
+ @options = options
20
21
  stubbing = options[:stub_pactfile_paths] && options[:stub_pactfile_paths].any?
21
22
  @name = options.fetch(:name, "MockService")
22
23
  @session = Session.new(options.merge(logger: logger, warn_on_too_many_interactions: !stubbing))
@@ -40,7 +41,7 @@ module Pact
40
41
  def setup_stub stub_pactfile_paths
41
42
  interactions = stub_pactfile_paths.collect do | pactfile_path |
42
43
  $stdout.puts "INFO: Loading interactions from #{pactfile_path}"
43
- hash_interactions = JSON.parse(Pact::PactFile.read(pactfile_path))['interactions']
44
+ hash_interactions = JSON.parse(Pact::PactFile.read(pactfile_path, pactfile_options))['interactions']
44
45
  hash_interactions.collect { | hash | Interaction.from_hash(hash) }
45
46
  end.flatten
46
47
  @session.set_expected_interactions interactions
@@ -57,6 +58,20 @@ module Pact
57
58
  def to_s
58
59
  "#{@name} #{super.to_s}"
59
60
  end
61
+
62
+ private
63
+
64
+ def pactfile_options
65
+ {
66
+ :token => broker_token,
67
+ :username => @options[:broker_username],
68
+ :password => @options[:broker_password],
69
+ }
70
+ end
71
+
72
+ def broker_token
73
+ @options[:broker_token] || ENV['PACT_BROKER_TOKEN']
74
+ end
60
75
  end
61
76
 
62
77
  # Can't write to a file in a TRAP, might deadlock
@@ -58,6 +58,9 @@ module Pact
58
58
  unique_pact_file_names: options[:unique_pact_file_names],
59
59
  consumer: options[:consumer],
60
60
  provider: options[:provider],
61
+ broker_token: options[:broker_token],
62
+ broker_username: options[:broker_username],
63
+ broker_password: options[:broker_password],
61
64
  cors_enabled: options[:cors],
62
65
  pact_specification_version: options[:pact_specification_version] || Pact::SpecificationVersion::NIL_VERSION.to_s,
63
66
  pactfile_write_mode: options[:pact_file_write_mode],
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module MockService
3
- VERSION = "3.4.0"
3
+ VERSION = "3.5.0"
4
4
  end
5
5
  end
@@ -27,6 +27,9 @@ module Pact
27
27
  method_option :port, aliases: "-p", desc: "Port on which to run the service"
28
28
  method_option :host, aliases: "-h", desc: "Host on which to bind the service", default: 'localhost'
29
29
  method_option :log, aliases: "-l", desc: "File to which to log output"
30
+ method_option :broker_username, aliases: "-n", desc: "Pact Broker basic auth username", :required => false
31
+ method_option :broker_password, aliases: "-p", desc: "Pact Broker basic auth password", :required => false
32
+ method_option :broker_token, aliases: "-k", desc: "Pact Broker bearer token", :required => false
30
33
  method_option :log_level, desc: "Log level. Options are DEBUG INFO WARN ERROR", default: "DEBUG"
31
34
  method_option :cors, aliases: "-o", desc: "Support browser security in tests by responding to OPTIONS requests and adding CORS headers to mocked responses"
32
35
  method_option :ssl, desc: "Use a self-signed SSL cert to run the service over HTTPS", type: :boolean, default: false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact-mock_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Fraser
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2020-01-16 00:00:00.000000000 Z
15
+ date: 2020-01-17 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rack