Skip to content

Commit 8f9a925

Browse files
Merge pull request #195 from cdambo/pass-pact-dir-to-cli
fix: send to cli pact_files with the pact_dir in their path
2 parents d2dda3f + 545fc37 commit 8f9a925

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

pact/pact.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,12 @@ def publish(self):
161161
+ "Did you expect the PACT_BROKER_BASE_URL "
162162
+ "environment variable to be set?")
163163

164-
pact_files = fnmatch.filter(
165-
os.listdir(self.pact_dir),
166-
self._normalize_consumer_name(self.consumer.name) + '*.json'
164+
pact_files = map(
165+
lambda filename: os.path.join(self.pact_dir, filename),
166+
fnmatch.filter(
167+
os.listdir(self.pact_dir),
168+
self._normalize_consumer_name(self.consumer.name) + '*.json'
169+
)
167170
)
168171
command = [
169172
BROKER_CLIENT_PATH,

tests/test_pact.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def test_publish_fails(self):
245245
BROKER_CLIENT_PATH, 'publish',
246246
'--consumer-app-version=0.0.0',
247247
'--broker-base-url=http://localhost',
248-
'TestConsumer-TestProvider.json'])
248+
os.path.join(pact.pact_dir, 'TestConsumer-TestProvider.json')])
249249

250250
def test_publish_without_broker_url(self):
251251
pact = Pact(self.consumer, self.provider, publish_to_broker=True)
@@ -271,7 +271,7 @@ def test_default_publish(self):
271271
BROKER_CLIENT_PATH, 'publish',
272272
'--consumer-app-version=0.0.0',
273273
'--broker-base-url=http://localhost',
274-
'TestConsumer-TestProvider.json'])
274+
os.path.join(pact.pact_dir, 'TestConsumer-TestProvider.json')])
275275

276276
def test_basic_authenticated_publish(self):
277277
pact = Pact(self.consumer, self.provider,
@@ -288,7 +288,7 @@ def test_basic_authenticated_publish(self):
288288
'--broker-base-url=http://localhost',
289289
'--broker-username=username',
290290
'--broker-password=password',
291-
'TestConsumer-TestProvider.json'])
291+
os.path.join(pact.pact_dir, 'TestConsumer-TestProvider.json')])
292292

293293
def test_token_authenticated_publish(self):
294294
pact = Pact(self.consumer, self.provider,
@@ -303,7 +303,7 @@ def test_token_authenticated_publish(self):
303303
'--consumer-app-version=0.0.0',
304304
'--broker-base-url=http://localhost',
305305
'--broker-token=token',
306-
'TestConsumer-TestProvider.json'])
306+
os.path.join(pact.pact_dir, 'TestConsumer-TestProvider.json')])
307307

308308
def test_git_tagged_publish(self):
309309
pact = Pact(Consumer('TestConsumer', tag_with_git_branch=True),
@@ -317,7 +317,7 @@ def test_git_tagged_publish(self):
317317
BROKER_CLIENT_PATH, 'publish',
318318
'--consumer-app-version=0.0.0',
319319
'--broker-base-url=http://localhost',
320-
'TestConsumer-TestProvider.json',
320+
os.path.join(pact.pact_dir, 'TestConsumer-TestProvider.json'),
321321
'--tag-with-git-branch'])
322322

323323
def test_manual_tagged_publish(self):
@@ -332,7 +332,7 @@ def test_manual_tagged_publish(self):
332332
BROKER_CLIENT_PATH, 'publish',
333333
'--consumer-app-version=0.0.0',
334334
'--broker-base-url=http://localhost',
335-
'TestConsumer-TestProvider.json',
335+
os.path.join(pact.pact_dir, 'TestConsumer-TestProvider.json'),
336336
'-t', 'tag1',
337337
'-t', 'tag2'])
338338

@@ -348,7 +348,7 @@ def test_versioned_publish(self):
348348
BROKER_CLIENT_PATH, 'publish',
349349
'--consumer-app-version=1.0.0',
350350
'--broker-base-url=http://localhost',
351-
'TestConsumer-TestProvider.json'])
351+
os.path.join(pact.pact_dir, 'TestConsumer-TestProvider.json')])
352352

353353
def test_publish_after_stop_service(self):
354354
self.mock_platform.return_value = 'Linux'

0 commit comments

Comments
 (0)