Skip to content

Commit 27cccff

Browse files
committed
RPClient.clone() method tests
1 parent b725aad commit 27cccff

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/test_client.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,23 @@ def test_statistics(send_event, getenv):
139139
client.session = mock.Mock()
140140
client.start_launch('Test Launch', timestamp())
141141
assert mock.call('start_launch', None, None) in send_event.mock_calls
142+
143+
144+
def test_clone():
145+
args = ['http://endpoint', 'project', 'token']
146+
kwargs = {'log_batch_size': 30, 'is_skipped_an_issue': False, 'verify_ssl': False, 'retries': 5,
147+
'max_pool_size': 30, 'launch_id': 'test-123', 'http_timeout': (30, 30),
148+
'log_batch_payload_size': 1000000, 'mode': 'DEBUG'}
149+
client = RPClient(*args, **kwargs)
150+
client._item_stack.append('test-321')
151+
client._item_stack.append('test-322')
152+
cloned = client.clone()
153+
assert cloned is not None and client is not cloned
154+
assert cloned.endpoint == args[0] and cloned.project == args[1] and cloned.token == args[2]
155+
assert cloned.log_batch_size == kwargs['log_batch_size'] and cloned.is_skipped_an_issue == kwargs[
156+
'is_skipped_an_issue'] and cloned.verify_ssl == kwargs['verify_ssl'] and cloned.retries == kwargs[
157+
'retries'] and cloned.max_pool_size == kwargs['max_pool_size'] and cloned.launch_id == kwargs[
158+
'launch_id'] and cloned.http_timeout == kwargs[
159+
'http_timeout'] and cloned.log_batch_payload_size == kwargs[
160+
'log_batch_payload_size'] and cloned.mode == kwargs['mode']
161+
assert len(cloned._item_stack) == 1 and client.current_item() == cloned.current_item()

0 commit comments

Comments
 (0)