Skip to content

Commit

Permalink
Keyword argument protocol changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Shrews committed Aug 8, 2024
1 parent b965f9c commit f8f3c72
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion test/unit/test_streaming.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from ansible_runner.streaming import Processor
from ansible_runner.streaming import Processor, Transmitter


class TestProcessor:
Expand All @@ -14,3 +14,30 @@ def test_artifact_dir_with_int_ident(self, tmp_path):
assert p.artifact_dir == os.path.join(kwargs['private_data_dir'],
'artifacts',
str(kwargs['ident']))


class TestTransmitter:

def test_job_arguments(self, tmp_path, project_fixtures):
"""
Test format of sending job arguments.
"""
transmit_dir = project_fixtures / 'debug'
outgoing_buffer_file = tmp_path / 'buffer_out'
outgoing_buffer_file.touch()

kwargs = {
'playbook': 'debug.yml',
'only_transmit_kwargs': True
}

with outgoing_buffer_file.open('b+r') as outgoing_buffer:
transmitter = Transmitter(_output=outgoing_buffer,
private_data_dir=transmit_dir,
**kwargs)
transmitter.run()
outgoing_buffer.seek(0)
sent = outgoing_buffer.read()

expected = b'{"kwargs": {"playbook": "debug.yml"}}\n{"eof": true}\n'
assert sent == expected

0 comments on commit f8f3c72

Please sign in to comment.