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 +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/pact/mock_service/app.rb +16 -1
- data/lib/pact/mock_service/run.rb +3 -0
- data/lib/pact/mock_service/version.rb +1 -1
- data/lib/pact/stub_service/cli.rb +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '07408e9dcc7fd09a8e3e9f99b818e9bf7c49a7b8dbc72b3a3e73b2c0d17086ef'
|
4
|
+
data.tar.gz: 9724d49997cce5add29605eae25ec3ed81f7ca3fea3c1eebb6e7a682e481d119
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 930ed339b550585517905bec02d6bee7c2f2f32892303934ceab41612f6c499d86730588d48b3c90fb5fd248baa1ad612c48d9a8d49e6ea5c8228f08a010cd0a
|
7
|
+
data.tar.gz: 8615335a96895ac305a554632c5ddf28aca9c73b8ddd9a6c9bcaf23888d6b832e43034993abc40dbf27c93e2a7c868746c54db8e61d153accc4a83d06141ddfe
|
data/CHANGELOG.md
CHANGED
@@ -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],
|
@@ -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
|
+
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-
|
15
|
+
date: 2020-01-17 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rack
|