Skip to content

Commit 48ad173

Browse files
Merge pull request #135 from m-aciek/master
Fix missing normalization of consumer name while publishing pact
2 parents 6948482 + b5af1fc commit 48ad173

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pact/pact.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ def given(self, provider_state):
149149
self._interactions[0]['provider_state'] = provider_state
150150
return self
151151

152+
@staticmethod
153+
def _normalize_consumer_name(name):
154+
return name.lower().replace(' ', '_')
155+
152156
def publish(self):
153157
"""Publish the generated pact files to the specified pact broker."""
154158
if self.broker_base_url is None \
@@ -157,8 +161,10 @@ def publish(self):
157161
"Did you expect the PACT_BROKER_BASE_URL " +
158162
"environment variable to be set?")
159163

160-
pact_files = fnmatch.filter(os.listdir(self.pact_dir),
161-
self.consumer.name + '*.json')
164+
pact_files = fnmatch.filter(
165+
os.listdir(self.pact_dir),
166+
self._normalize_consumer_name(self.consumer.name) + '*.json'
167+
)
162168
command = [
163169
BROKER_CLIENT_PATH,
164170
'publish',

0 commit comments

Comments
 (0)