holado 0.2.7__py3-none-any.whl → 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of holado might be problematic. Click here for more details.

Files changed (118) hide show
  1. holado/common/handlers/undefined.py +7 -1
  2. {holado-0.2.7.dist-info → holado-0.3.0.dist-info}/METADATA +7 -1
  3. {holado-0.2.7.dist-info → holado-0.3.0.dist-info}/RECORD +116 -107
  4. holado_ais/ais/ais_messages.py +97 -6
  5. holado_ais/tests/behave/steps/ais/ais_manager_steps.py +1 -1
  6. holado_ais/tests/behave/steps/ais/ais_messages_steps.py +45 -6
  7. holado_binary/ipc/bit_series.py +3 -3
  8. holado_binary/tests/behave/steps/ipc/binary_steps.py +1 -1
  9. holado_binary/tests/behave/steps/ipc/bit_series_steps.py +4 -3
  10. holado_context/tests/behave/steps/private/common/context_steps.py +1 -1
  11. holado_core/common/resource/persisted_data_manager.py +13 -16
  12. holado_core/common/resource/resource_manager.py +10 -10
  13. holado_core/common/tables/converters/table_converter.py +47 -9
  14. holado_core/common/tables/table.py +2 -2
  15. holado_core/common/tables/table_manager.py +6 -7
  16. holado_core/common/tables/table_with_header.py +6 -0
  17. holado_core/common/tools/string_tools.py +9 -0
  18. holado_core/tests/behave/steps/common/common_steps.py +2 -1
  19. holado_core/tests/behave/steps/common/config_steps.py +1 -1
  20. holado_core/tests/behave/steps/common/resource_steps.py +1 -1
  21. holado_core/tests/behave/steps/common/tables_steps.py +27 -4
  22. holado_data/data/generator/generator_manager.py +39 -0
  23. holado_data/tests/behave/steps/data/generator_steps.py +1 -1
  24. holado_data/tests/behave/steps/tools/utils_steps.py +1 -2
  25. holado_db/tests/behave/steps/tools/db/db_client_steps.py +1 -1
  26. holado_db/tests/behave/steps/tools/db/postgresql_client_steps.py +1 -1
  27. holado_db/tests/behave/steps/tools/db/sqlite_client_steps.py +1 -1
  28. holado_db/tools/db/clients/base/db_client.py +81 -28
  29. holado_db/tools/db/clients/postgresql/postgresql_client.py +17 -7
  30. holado_db/tools/db/query/base/query_builder.py +58 -7
  31. holado_db/tools/db/query/pypika/pypika_query_builder.py +73 -21
  32. holado_docker/tests/behave/steps/tools/docker_steps.py +1 -1
  33. holado_grpc/tests/behave/steps/api/grpc_client_steps.py +1 -1
  34. holado_grpc/tests/behave/steps/private/api/grpc_steps.py +1 -1
  35. holado_helper/script/action.py +16 -7
  36. holado_json/tests/behave/steps/ipc/json_steps.py +1 -1
  37. holado_keycloak/tests/behave/steps/tools/keycloak_client_steps.py +1 -1
  38. holado_multitask/tests/behave/steps/multiprocessing_steps.py +1 -1
  39. holado_multitask/tests/behave/steps/multithreading_steps.py +1 -1
  40. holado_protobuf/ipc/protobuf/types/google/protobuf.py +1 -1
  41. holado_protobuf/tests/behave/steps/ipc/protobuf_steps.py +1 -1
  42. holado_python/common/tools/datetime.py +31 -12
  43. holado_python/standard_library/socket/blocking_socket.py +112 -42
  44. holado_python/standard_library/socket/echo_server.py +4 -3
  45. holado_python/standard_library/socket/message_socket.py +69 -22
  46. holado_python/standard_library/socket/non_blocking_socket.py +65 -67
  47. holado_python/standard_library/socket/socket.py +272 -32
  48. holado_python/standard_library/ssl/resources/certificates/NOTES.txt +1 -1
  49. holado_python/standard_library/ssl/resources/certificates/rootCACert.pem +24 -0
  50. holado_python/standard_library/ssl/resources/certificates/tcpbin.crt +21 -0
  51. holado_python/standard_library/ssl/resources/certificates/tcpbin.key +28 -0
  52. holado_python/standard_library/ssl/ssl.py +138 -21
  53. holado_python/tests/behave/steps/convert_steps.py +1 -1
  54. holado_python/tests/behave/steps/iterable_steps.py +1 -1
  55. holado_python/tests/behave/steps/standard_library/csv_steps.py +1 -1
  56. holado_python/tests/behave/steps/standard_library/datetime_steps.py +1 -1
  57. holado_python/tests/behave/steps/standard_library/hashlib_steps.py +1 -1
  58. holado_python/tests/behave/steps/standard_library/multiprocessing_steps.py +1 -1
  59. holado_python/tests/behave/steps/standard_library/queue_steps.py +1 -1
  60. holado_python/tests/behave/steps/standard_library/socket_steps.py +147 -21
  61. holado_python/tests/behave/steps/standard_library/ssl_steps.py +87 -16
  62. holado_rabbitmq/tests/behave/steps/tools/rabbitmq_client_steps.py +48 -20
  63. holado_rabbitmq/tests/behave/steps/tools/rabbitmq_server_steps.py +1 -1
  64. holado_rabbitmq/tools/rabbitmq/rabbitmq_client.py +19 -13
  65. holado_rabbitmq/tools/rabbitmq/rabbitmq_manager.py +2 -29
  66. holado_redis/tests/behave/steps/tools/redis_client_steps.py +1 -1
  67. holado_rest/tests/behave/steps/api/rest_client_steps.py +1 -1
  68. holado_rest/tests/behave/steps/private/api/rest_steps.py +1 -1
  69. holado_s3/tests/behave/steps/private/tools/s3_steps.py +1 -1
  70. holado_s3/tests/behave/steps/tools/s3_client_steps.py +1 -1
  71. holado_s3/tests/behave/steps/tools/s3_server_steps.py +1 -1
  72. holado_scripting/tests/behave/steps/common/tools/variable_convert_steps.py +3 -2
  73. holado_scripting/tests/behave/steps/common/tools/variable_new_steps.py +1 -1
  74. holado_scripting/tests/behave/steps/common/tools/variable_steps.py +1 -1
  75. holado_scripting/tests/behave/steps/common/tools/variable_verify_steps.py +1 -1
  76. holado_scripting/tests/behave/steps/scenario/function_steps.py +1 -1
  77. holado_scripting/tests/behave/steps/scenario/if_steps.py +1 -1
  78. holado_scripting/tests/behave/steps/scenario/loop_steps.py +1 -1
  79. holado_scripting/text/interpreter/functions/function_apply_function.py +60 -0
  80. holado_scripting/text/interpreter/functions/function_to_string.py +50 -0
  81. holado_scripting/text/interpreter/text_interpreter.py +4 -0
  82. holado_sftp/tests/behave/steps/private/tools/sftp_steps.py +1 -1
  83. holado_sftp/tests/behave/steps/tools/sftp_client_steps.py +1 -1
  84. holado_sftp/tests/behave/steps/tools/sftp_server_steps.py +1 -1
  85. holado_swagger/tests/behave/steps/swagger_hub/mockserver_steps.py +1 -1
  86. holado_system/system/command/command.py +14 -9
  87. holado_system/tests/behave/steps/system/commands_steps.py +1 -1
  88. holado_system/tests/behave/steps/system/file_steps.py +1 -1
  89. holado_system/tests/behave/steps/system/system_steps.py +1 -1
  90. holado_test/scenario/step_tools.py +5 -4
  91. holado_test/scenario/tester_tools.py +6 -3
  92. holado_test/tests/behave/steps/scenario/exception_steps.py +1 -1
  93. holado_test/tests/behave/steps/scenario/scenario_steps.py +1 -1
  94. holado_test/tests/behave/steps/scenario/tester_steps.py +4 -4
  95. holado_value/common/tables/converters/value_table_converter.py +52 -8
  96. holado_value/common/tables/value_table_cell.py +5 -0
  97. holado_value/common/tables/value_table_manager.py +0 -10
  98. holado_value/common/tables/value_table_row.py +0 -1
  99. holado_value/common/tools/value.py +5 -1
  100. holado_ws/tests/behave/steps/api/web_service_steps.py +1 -1
  101. holado_yaml/tests/behave/steps/yaml_steps.py +1 -1
  102. holado_yaml/yaml/yaml_manager.py +2 -2
  103. test_holado/features/NonReg/common/tables/table.feature +30 -24
  104. test_holado/features/NonReg/holado_ais/ais_message-bitarray_to_nmea.feature +1 -1
  105. test_holado/features/NonReg/holado_python/standard_library/socket/local_echo_server/socket_reset.feature +191 -0
  106. test_holado/features/NonReg/holado_python/standard_library/{socket_with_ssl.feature → socket/local_echo_server/socket_with_tls_and_verify.feature} +126 -27
  107. test_holado/features/NonReg/holado_python/standard_library/socket/local_echo_server/socket_with_tls_without_verify.feature +299 -0
  108. test_holado/features/NonReg/holado_python/standard_library/{socket.feature → socket/local_echo_server/socket_without_tls.feature} +63 -1
  109. test_holado/features/NonReg/holado_python/standard_library/socket/tcpbin.com/socket_with_mtls.feature +214 -0
  110. test_holado/features/NonReg/holado_python/standard_library/socket/tcpbin.com/socket_with_tls.feature +184 -0
  111. test_holado/features/NonReg/holado_python/standard_library/socket/tcpbin.com/socket_without_tls.feature +169 -0
  112. test_holado/features/NonReg/tools/RabbitMQ.feature +9 -9
  113. test_holado/features/NonReg/tools/RabbitMQ_steps.feature +8 -8
  114. test_holado/logging.conf +5 -3
  115. holado_core/common/transport/__init__.py +0 -0
  116. holado_core/common/transport/crc.py +0 -40
  117. {holado-0.2.7.dist-info → holado-0.3.0.dist-info}/WHEEL +0 -0
  118. {holado-0.2.7.dist-info → holado-0.3.0.dist-info}/licenses/LICENSE +0 -0
@@ -2,7 +2,8 @@
2
2
  @python
3
3
  @socket
4
4
  @ssl
5
- Feature: Test python socket steps with ssl
5
+ @with_cert_file
6
+ Feature: Test python socket steps with ssl and cert files
6
7
 
7
8
  @blocking_socket
8
9
  Scenario: Server and client with blocking connections
@@ -10,35 +11,42 @@ Feature: Test python socket steps with ssl
10
11
  ### PRECONDITIONS - BEGIN
11
12
  Given begin preconditions
12
13
 
13
- # Get files of a self-signed certificate
14
- Given CERTFILE_PATH = certfile path for localhost
15
- Given KEYFILE_PATH = keyfile path for localhost
14
+ # Generate key files
15
+ Given CERTFILE_PATH = path to file with name 'localhost.crt'
16
+ Given KEYFILE_PATH = path to file with name 'localhost.key'
17
+ Given generate new self-signed key files for localhost
18
+ | Name | Value |
19
+ | 'public_key_path' | CERTFILE_PATH |
20
+ | 'private_key_path' | KEYFILE_PATH |
21
+ | 'algorithm' | 'rsa:2048' |
16
22
 
17
23
  # Use echo server with a blocking connection
18
24
  Given PORT = first available anonymous port
19
25
  Given SERVER = new echo TCP socket server
20
- | Name | Value |
21
- | 'host' | 'localhost' |
22
- | 'port' | PORT |
23
- | 'ssl.activate' | True |
24
- | 'ssl.context.ciphers' | 'SHA256' |
25
- | 'ssl.context.load_cert_chain.certfile' | CERTFILE_PATH |
26
- | 'ssl.context.load_cert_chain.keyfile' | KEYFILE_PATH |
26
+ | Name | Value |
27
+ | 'host' | 'localhost' |
28
+ | 'port' | PORT |
29
+ | 'ssl.activate' | True |
30
+ | 'ssl.context.ciphers' | 'SHA256' |
31
+ | 'ssl.context.load_cert_chain.certfile' | CERTFILE_PATH |
32
+ | 'ssl.context.load_cert_chain.keyfile' | KEYFILE_PATH |
27
33
 
28
34
  # Create a TCP client with a blocking connection
29
35
  Given CLIENT = new TCP socket client
30
- | Name | Value |
31
- | 'host' | 'localhost' |
32
- | 'port' | PORT |
33
- | 'ssl.activate' | True |
34
- | 'ssl.context.check_hostname' | True |
35
- | 'ssl.context.load_verify_locations.cafile' | CERTFILE_PATH |
36
+ | Name | Value |
37
+ | 'host' | 'localhost' |
38
+ | 'port' | PORT |
39
+ | 'ssl.activate' | True |
40
+ | 'ssl.context.ciphers' | 'SHA256' |
41
+ | 'ssl.context.check_hostname' | True |
42
+ | 'ssl.context.load_verify_locations.cafile' | CERTFILE_PATH |
36
43
 
37
44
  Given end preconditions
38
45
  ### PRECONDITIONS - END
39
46
 
40
47
  # Start echo server
41
48
  When start (socket server: SERVER)
49
+ When ensure SSL handshake is done (socket: CLIENT)
42
50
 
43
51
  # Write data and verify result is identical
44
52
  When write b'\x01\x02' (socket: CLIENT)
@@ -59,9 +67,14 @@ Feature: Test python socket steps with ssl
59
67
  ### PRECONDITIONS - BEGIN
60
68
  Given begin preconditions
61
69
 
62
- # Get files of a self-signed certificate
63
- Given CERTFILE_PATH = certfile path for localhost
64
- Given KEYFILE_PATH = keyfile path for localhost
70
+ # Generate key files
71
+ Given CERTFILE_PATH = path to file with name 'localhost.crt'
72
+ Given KEYFILE_PATH = path to file with name 'localhost.key'
73
+ Given generate new self-signed key files for localhost
74
+ | Name | Value |
75
+ | 'public_key_path' | CERTFILE_PATH |
76
+ | 'private_key_path' | KEYFILE_PATH |
77
+ | 'algorithm' | 'rsa:2048' |
65
78
 
66
79
  # Use echo server with a blocking connection
67
80
  Given PORT = first available anonymous port
@@ -93,12 +106,12 @@ Feature: Test python socket steps with ssl
93
106
 
94
107
  # Write data and verify result is identical
95
108
  When write b'\x01\x02' (socket: CLIENT)
96
- When wait socket CLIENT stops to receive data (window: 0.1 s)
109
+ When await socket CLIENT receives data (window: 0.1 s)
97
110
  When DATA = read (socket: CLIENT)
98
111
  Then DATA == b'\x01\x02'
99
112
 
100
113
  When write b'\x11\x21' (socket: CLIENT)
101
- When wait socket CLIENT stops to receive data (window: 0.1 s)
114
+ When await socket CLIENT receives data (window: 0.1 s)
102
115
  When DATA = read (socket: CLIENT)
103
116
  Then DATA == b'\x11\x21'
104
117
 
@@ -109,14 +122,20 @@ Feature: Test python socket steps with ssl
109
122
 
110
123
 
111
124
  @message_socket
112
- Scenario: Echo server and message client (with underlying non blocking connection)
125
+ @blocking_socket
126
+ Scenario: Echo server and message client (with underlying blocking connection)
113
127
 
114
128
  ### PRECONDITIONS - BEGIN
115
129
  Given begin preconditions
116
130
 
117
- # Get files of a self-signed certificate
118
- Given CERTFILE_PATH = certfile path for localhost
119
- Given KEYFILE_PATH = keyfile path for localhost
131
+ # Generate key files
132
+ Given CERTFILE_PATH = path to file with name 'localhost.crt'
133
+ Given KEYFILE_PATH = path to file with name 'localhost.key'
134
+ Given generate new self-signed key files for localhost
135
+ | Name | Value |
136
+ | 'public_key_path' | CERTFILE_PATH |
137
+ | 'private_key_path' | KEYFILE_PATH |
138
+ | 'algorithm' | 'rsa:2048' |
120
139
 
121
140
  # Use echo server with a blocking connection
122
141
  Given PORT = first available anonymous port
@@ -144,6 +163,86 @@ Feature: Test python socket steps with ssl
144
163
 
145
164
  # Start echo server & message client
146
165
  When start (socket server: SERVER)
166
+ #When ensure SSL handshake is done (socket: CLIENT)
167
+ When start (socket client: CLIENT)
168
+
169
+ # Write data and verify result is identical
170
+ When write message b'\x01\x02' (socket: CLIENT)
171
+ When write message b'\x11\x21' (socket: CLIENT)
172
+
173
+ # Verify received messages
174
+ When await socket CLIENT receives messages (window: 0.1 s)
175
+ When MESSAGES = received messages (socket: CLIENT)
176
+ Then MESSAGES is list
177
+ | b'\x01\x02' |
178
+ | b'\x11\x21' |
179
+
180
+ When MESSAGES_2 = received messages (socket: CLIENT)
181
+ Then MESSAGES_2 == MESSAGES
182
+
183
+ # Verify pop messages functionality
184
+ When MSG_1 = read message (socket: CLIENT)
185
+ Then MSG_1 == b'\x01\x02'
186
+ When MESSAGES_3 = received messages (socket: CLIENT)
187
+ Then MESSAGES_3 is list
188
+ | b'\x11\x21' |
189
+
190
+ When MSG_2 = read message (socket: CLIENT)
191
+ Then MSG_2 == b'\x11\x21'
192
+ When MESSAGES_4 = received messages (socket: CLIENT)
193
+ Then MESSAGES_4 is empty list
194
+
195
+ # Stop server & client
196
+ #When stop (socket server: SERVER)
197
+ # Note: currently, stop doesn't work with SSL and blocking connection
198
+ When stop (socket client: CLIENT)
199
+
200
+
201
+
202
+ @message_socket
203
+ @non_blocking_socket
204
+ Scenario: Echo server and message client (with underlying non-blocking connection)
205
+
206
+ ### PRECONDITIONS - BEGIN
207
+ Given begin preconditions
208
+
209
+ # Generate key files
210
+ Given CERTFILE_PATH = path to file with name 'localhost.crt'
211
+ Given KEYFILE_PATH = path to file with name 'localhost.key'
212
+ Given generate new self-signed key files for localhost
213
+ | Name | Value |
214
+ | 'public_key_path' | CERTFILE_PATH |
215
+ | 'private_key_path' | KEYFILE_PATH |
216
+ | 'algorithm' | 'rsa:2048' |
217
+
218
+ # Use echo server with a blocking connection
219
+ Given PORT = first available anonymous port
220
+ Given SERVER = new echo TCP socket server
221
+ | Name | Value |
222
+ | 'host' | 'localhost' |
223
+ | 'port' | PORT |
224
+ | 'ssl.activate' | True |
225
+ | 'ssl.context.ciphers' | 'SHA256' |
226
+ | 'ssl.context.load_cert_chain.certfile' | CERTFILE_PATH |
227
+ | 'ssl.context.load_cert_chain.keyfile' | KEYFILE_PATH |
228
+
229
+ # Create a message client
230
+ Given CLIENT = new message TCP socket client
231
+ | Name | Value |
232
+ | 'host' | 'localhost' |
233
+ | 'port' | PORT |
234
+ | 'separator' | b'\n' |
235
+ | 'blocking' | False |
236
+ | 'ssl.activate' | True |
237
+ | 'ssl.context.check_hostname' | True |
238
+ | 'ssl.context.load_verify_locations.cafile' | CERTFILE_PATH |
239
+
240
+ Given end preconditions
241
+ ### PRECONDITIONS - END
242
+
243
+ # Start echo server & message client
244
+ When start (socket server: SERVER)
245
+ #When ensure SSL handshake is done (socket: CLIENT)
147
246
  When start (socket client: CLIENT)
148
247
 
149
248
  # Write data and verify result is identical
@@ -151,7 +250,7 @@ Feature: Test python socket steps with ssl
151
250
  When write message b'\x11\x21' (socket: CLIENT)
152
251
 
153
252
  # Verify received messages
154
- When wait socket CLIENT stops to receive messages (window: 0.1 s)
253
+ When await socket CLIENT receives messages (window: 0.1 s)
155
254
  When MESSAGES = received messages (socket: CLIENT)
156
255
  Then MESSAGES is list
157
256
  | b'\x01\x02' |
@@ -0,0 +1,299 @@
1
+ @testing_solution
2
+ @python
3
+ @socket
4
+ @ssl
5
+ @without_cert_file
6
+ Feature: Test python socket steps with ssl, server with self-signed keys, and client doesn't verify certificate
7
+
8
+ @blocking_socket
9
+ Scenario: Server and client with blocking connections
10
+
11
+ ### PRECONDITIONS - BEGIN
12
+ Given begin preconditions
13
+
14
+ # Get certificate
15
+ #Given CACERTS_PATH = default CA certs file path
16
+ #Given CACERTS_PATH = CA certs file path (from certifi package)
17
+ #Given CERTS_PATH = default certs directory path
18
+
19
+ # Generate key files
20
+ Given CERTFILE_PATH = path to file with name 'localhost.crt'
21
+ Given KEYFILE_PATH = path to file with name 'localhost.key'
22
+ Given generate new self-signed key files for localhost
23
+ | Name | Value |
24
+ | 'public_key_path' | CERTFILE_PATH |
25
+ | 'private_key_path' | KEYFILE_PATH |
26
+ | 'algorithm' | 'rsa:2048' |
27
+
28
+ # Use echo server with a blocking connection
29
+ Given PORT = first available anonymous port
30
+ Given SERVER = new echo TCP socket server
31
+ | Name | Value |
32
+ | 'host' | 'localhost' |
33
+ | 'port' | PORT |
34
+ | 'ssl.activate' | True |
35
+ #| 'ssl.create_default_context.cafile' | CACERTS_PATH |
36
+ #| 'ssl.create_default_context.capath' | CERTS_PATH |
37
+ | 'ssl.context.ciphers' | 'ALL' |
38
+ #| 'ssl.context.ciphers' | '@SECLEVEL=2:ECDH+AESGCM:ECDH+CHACHA20:ECDH+AES:DHE+AES:AESGCM:!aNULL:!eNULL:!aDSS:!SHA1:!AESCCM:!PSK' |
39
+ #| 'ssl.context.ciphers' | 'AES256-GCM-SHA384' |
40
+ #| 'ssl.context.ciphers' | 'DEFAULT' |
41
+ #| 'ssl.context.ciphers' | 'OPENSSL_CIPHERS' |
42
+ #| 'ssl.context.ciphers' | '@SECLEVEL=1:ALL' |
43
+ | 'ssl.context.load_cert_chain.certfile' | CERTFILE_PATH |
44
+ | 'ssl.context.load_cert_chain.keyfile' | KEYFILE_PATH |
45
+ #| 'ssl.context.minimum_version' | ssl.TLSVersion.TLSv1_2 |
46
+
47
+ # Create a TCP client with a blocking connection
48
+ Given CLIENT = new TCP socket client
49
+ | Name | Value |
50
+ | 'host' | 'localhost' |
51
+ | 'port' | PORT |
52
+ | 'ssl.activate' | True |
53
+ #| 'ssl.create_default_context.cafile' | CERTFILE_PATH |
54
+ | 'ssl.context.ciphers' | 'ALL' |
55
+ #| 'ssl.context.ciphers' | '@SECLEVEL=2:ECDH+AESGCM:ECDH+CHACHA20:ECDH+AES:DHE+AES:AESGCM:!aNULL:!eNULL:!aDSS:!SHA1:!AESCCM:!PSK' |
56
+ #| 'ssl.context.ciphers' | 'AES256-GCM-SHA384' |
57
+ #| 'ssl.context.ciphers' | 'DEFAULT' |
58
+ #| 'ssl.context.ciphers' | 'OPENSSL_CIPHERS' |
59
+ #| 'ssl.context.ciphers' | '@SECLEVEL=1:ALL' |
60
+ #| 'ssl.context.minimum_version' | ssl.TLSVersion.TLSv1_2 |
61
+ | 'ssl.context.check_hostname' | False |
62
+ | 'ssl.context.verify_mode' | ssl.CERT_NONE |
63
+ #| 'ssl.context.load_verify_locations.cafile' | CERTFILE_PATH |
64
+
65
+ Given end preconditions
66
+ ### PRECONDITIONS - END
67
+
68
+ # Start echo server
69
+ When start (socket server: SERVER)
70
+ When ensure SSL handshake is done (socket: CLIENT)
71
+
72
+ # Write data and verify result is identical
73
+ When write b'\x01\x02' (socket: CLIENT)
74
+ When DATA = read (socket: CLIENT)
75
+ Then DATA == b'\x01\x02'
76
+
77
+ When write b'\x11\x21' (socket: CLIENT)
78
+ When DATA = read (socket: CLIENT)
79
+ Then DATA == b'\x11\x21'
80
+
81
+ # Stop server
82
+ #When stop (socket server: SERVER)
83
+
84
+
85
+ @non_blocking_socket
86
+ Scenario: Server and client with non blocking connection
87
+
88
+ ### PRECONDITIONS - BEGIN
89
+ Given begin preconditions
90
+
91
+ # Generate key files
92
+ Given CERTFILE_PATH = path to file with name 'localhost.crt'
93
+ Given KEYFILE_PATH = path to file with name 'localhost.key'
94
+ Given generate new self-signed key files for localhost
95
+ | Name | Value |
96
+ | 'public_key_path' | CERTFILE_PATH |
97
+ | 'private_key_path' | KEYFILE_PATH |
98
+ | 'algorithm' | 'rsa:2048' |
99
+
100
+ # Use echo server with a blocking connection
101
+ Given PORT = first available anonymous port
102
+ Given SERVER = new echo TCP socket server
103
+ | Name | Value |
104
+ | 'host' | 'localhost' |
105
+ | 'port' | PORT |
106
+ | 'ssl.activate' | True |
107
+ | 'ssl.context.ciphers' | 'ALL' |
108
+ | 'ssl.context.load_cert_chain.certfile' | CERTFILE_PATH |
109
+ | 'ssl.context.load_cert_chain.keyfile' | KEYFILE_PATH |
110
+
111
+ # Create a TCP client with a blocking connection
112
+ Given CLIENT = new TCP socket client
113
+ | Name | Value |
114
+ | 'host' | 'localhost' |
115
+ | 'port' | PORT |
116
+ | 'blocking' | False |
117
+ | 'ssl.activate' | True |
118
+ | 'ssl.context.check_hostname' | False |
119
+ | 'ssl.context.verify_mode' | ssl.CERT_NONE |
120
+
121
+ Given end preconditions
122
+ ### PRECONDITIONS - END
123
+
124
+ # Start echo server & client
125
+ When start (socket server: SERVER)
126
+ When start (socket client: CLIENT)
127
+
128
+ # Write data and verify result is identical
129
+ When write b'\x01\x02' (socket: CLIENT)
130
+ When await socket CLIENT receives data (window: 0.1 s)
131
+ When DATA = read (socket: CLIENT)
132
+ Then DATA == b'\x01\x02'
133
+
134
+ When write b'\x11\x21' (socket: CLIENT)
135
+ When await socket CLIENT receives data (window: 0.1 s)
136
+ When DATA = read (socket: CLIENT)
137
+ Then DATA == b'\x11\x21'
138
+
139
+ # Stop server & client
140
+ #When stop (socket server: SERVER)
141
+ When stop (socket client: CLIENT)
142
+
143
+
144
+
145
+ @message_socket
146
+ @blocking_socket
147
+ Scenario: Echo server and message client (with underlying blocking connection)
148
+
149
+ ### PRECONDITIONS - BEGIN
150
+ Given begin preconditions
151
+
152
+ # Generate key files
153
+ Given CERTFILE_PATH = path to file with name 'localhost.crt'
154
+ Given KEYFILE_PATH = path to file with name 'localhost.key'
155
+ Given generate new self-signed key files for localhost
156
+ | Name | Value |
157
+ | 'public_key_path' | CERTFILE_PATH |
158
+ | 'private_key_path' | KEYFILE_PATH |
159
+ | 'algorithm' | 'rsa:2048' |
160
+
161
+ # Use echo server with a blocking connection
162
+ Given PORT = first available anonymous port
163
+ Given SERVER = new echo TCP socket server
164
+ | Name | Value |
165
+ | 'host' | 'localhost' |
166
+ | 'port' | PORT |
167
+ | 'ssl.activate' | True |
168
+ | 'ssl.context.ciphers' | 'OPENSSL_CIPHERS' |
169
+ | 'ssl.context.load_cert_chain.certfile' | CERTFILE_PATH |
170
+ | 'ssl.context.load_cert_chain.keyfile' | KEYFILE_PATH |
171
+
172
+ # Create a message client
173
+ Given CLIENT = new message TCP socket client
174
+ | Name | Value |
175
+ | 'host' | 'localhost' |
176
+ | 'port' | PORT |
177
+ | 'separator' | b'\n' |
178
+ | 'ssl.activate' | True |
179
+ | 'ssl.context.check_hostname' | False |
180
+ | 'ssl.context.verify_mode' | ssl.CERT_NONE |
181
+
182
+ Given end preconditions
183
+ ### PRECONDITIONS - END
184
+
185
+ # Start echo server & message client
186
+ When start (socket server: SERVER)
187
+ #When ensure SSL handshake is done (socket: CLIENT)
188
+ When start (socket client: CLIENT)
189
+
190
+ # Write data and verify result is identical
191
+ When write message b'\x01\x02' (socket: CLIENT)
192
+ When write message b'\x11\x21' (socket: CLIENT)
193
+
194
+ # Verify received messages
195
+ When await socket CLIENT receives messages (window: 0.1 s)
196
+ When MESSAGES = received messages (socket: CLIENT)
197
+ Then MESSAGES is list
198
+ | b'\x01\x02' |
199
+ | b'\x11\x21' |
200
+
201
+ When MESSAGES_2 = received messages (socket: CLIENT)
202
+ Then MESSAGES_2 == MESSAGES
203
+
204
+ # Verify pop messages functionality
205
+ When MSG_1 = read message (socket: CLIENT)
206
+ Then MSG_1 == b'\x01\x02'
207
+ When MESSAGES_3 = received messages (socket: CLIENT)
208
+ Then MESSAGES_3 is list
209
+ | b'\x11\x21' |
210
+
211
+ When MSG_2 = read message (socket: CLIENT)
212
+ Then MSG_2 == b'\x11\x21'
213
+ When MESSAGES_4 = received messages (socket: CLIENT)
214
+ Then MESSAGES_4 is empty list
215
+
216
+ # Stop server & client
217
+ #When stop (socket server: SERVER)
218
+ When stop (socket client: CLIENT)
219
+
220
+
221
+
222
+ @message_socket
223
+ @non_blocking_socket
224
+ Scenario: Echo server and message client (with underlying non-blocking connection)
225
+
226
+ ### PRECONDITIONS - BEGIN
227
+ Given begin preconditions
228
+
229
+ # Generate key files
230
+ Given CERTFILE_PATH = path to file with name 'localhost.crt'
231
+ Given KEYFILE_PATH = path to file with name 'localhost.key'
232
+ Given generate new self-signed key files for localhost
233
+ | Name | Value |
234
+ | 'public_key_path' | CERTFILE_PATH |
235
+ | 'private_key_path' | KEYFILE_PATH |
236
+ | 'algorithm' | 'rsa:2048' |
237
+
238
+ # Use echo server with a blocking connection
239
+ Given PORT = first available anonymous port
240
+ Given SERVER = new echo TCP socket server
241
+ | Name | Value |
242
+ | 'host' | 'localhost' |
243
+ | 'port' | PORT |
244
+ | 'ssl.activate' | True |
245
+ | 'ssl.context.ciphers' | 'SHA256' |
246
+ | 'ssl.context.load_cert_chain.certfile' | CERTFILE_PATH |
247
+ | 'ssl.context.load_cert_chain.keyfile' | KEYFILE_PATH |
248
+
249
+ # Create a message client
250
+ Given CLIENT = new message TCP socket client
251
+ | Name | Value |
252
+ | 'host' | 'localhost' |
253
+ | 'port' | PORT |
254
+ | 'separator' | b'\n' |
255
+ | 'blocking' | False |
256
+ | 'ssl.activate' | True |
257
+ | 'ssl.context.check_hostname' | False |
258
+ | 'ssl.context.verify_mode' | ssl.CERT_NONE |
259
+
260
+ Given end preconditions
261
+ ### PRECONDITIONS - END
262
+
263
+ # Start echo server & message client
264
+ When start (socket server: SERVER)
265
+ #When ensure SSL handshake is done (socket: CLIENT)
266
+ When start (socket client: CLIENT)
267
+
268
+ # Write data and verify result is identical
269
+ When write message b'\x01\x02' (socket: CLIENT)
270
+ When write message b'\x11\x21' (socket: CLIENT)
271
+
272
+ # Verify received messages
273
+ When await socket CLIENT receives messages (window: 0.1 s)
274
+ When MESSAGES = received messages (socket: CLIENT)
275
+ Then MESSAGES is list
276
+ | b'\x01\x02' |
277
+ | b'\x11\x21' |
278
+
279
+ When MESSAGES_2 = received messages (socket: CLIENT)
280
+ Then MESSAGES_2 == MESSAGES
281
+
282
+ # Verify pop messages functionality
283
+ When MSG_1 = read message (socket: CLIENT)
284
+ Then MSG_1 == b'\x01\x02'
285
+ When MESSAGES_3 = received messages (socket: CLIENT)
286
+ Then MESSAGES_3 is list
287
+ | b'\x11\x21' |
288
+
289
+ When MSG_2 = read message (socket: CLIENT)
290
+ Then MSG_2 == b'\x11\x21'
291
+ When MESSAGES_4 = received messages (socket: CLIENT)
292
+ Then MESSAGES_4 is empty list
293
+
294
+ # Stop server & client
295
+ #When stop (socket server: SERVER)
296
+ When stop (socket client: CLIENT)
297
+
298
+
299
+
@@ -41,6 +41,67 @@ Feature: Test python socket steps
41
41
 
42
42
 
43
43
  @message_socket
44
+ @blocking_socket
45
+ Scenario: Echo server and message client with blocking connection
46
+
47
+ ### PRECONDITIONS - BEGIN
48
+ Given begin preconditions
49
+
50
+ # Use echo server with a blocking connection
51
+ Given PORT = first available anonymous port
52
+ Given SERVER = new echo TCP socket server
53
+ | Name | Value |
54
+ | 'host' | '127.0.0.1' |
55
+ | 'port' | PORT |
56
+
57
+ # Create a message client
58
+ Given CLIENT = new message TCP socket client
59
+ | Name | Value |
60
+ | 'host' | '127.0.0.1' |
61
+ | 'port' | PORT |
62
+ | 'separator' | b'\n' |
63
+
64
+ Given end preconditions
65
+ ### PRECONDITIONS - END
66
+
67
+ # Start echo server & message client
68
+ When start (socket server: SERVER)
69
+ When start (socket client: CLIENT)
70
+
71
+ # Write data and verify result is identical
72
+ When write message b'\x01\x02' (socket: CLIENT)
73
+ When write message b'\x11\x21' (socket: CLIENT)
74
+
75
+ # Verify received messages
76
+ When await socket CLIENT receives messages (window: 0.1 s)
77
+ When MESSAGES = received messages (socket: CLIENT)
78
+ Then MESSAGES is list
79
+ | b'\x01\x02' |
80
+ | b'\x11\x21' |
81
+
82
+ When MESSAGES_2 = received messages (socket: CLIENT)
83
+ Then MESSAGES_2 == MESSAGES
84
+
85
+ # Verify pop messages functionality
86
+ When MSG_1 = read message (socket: CLIENT)
87
+ Then MSG_1 == b'\x01\x02'
88
+ When MESSAGES_3 = received messages (socket: CLIENT)
89
+ Then MESSAGES_3 is list
90
+ | b'\x11\x21' |
91
+
92
+ When MSG_2 = read message (socket: CLIENT)
93
+ Then MSG_2 == b'\x11\x21'
94
+ When MESSAGES_4 = received messages (socket: CLIENT)
95
+ Then MESSAGES_4 is empty list
96
+
97
+ # Stop server & client
98
+ #When stop (socket server: SERVER)
99
+ When stop (socket client: CLIENT)
100
+
101
+
102
+
103
+ @message_socket
104
+ @non_blocking_socket
44
105
  Scenario: Echo server and message client with non blocking connection
45
106
 
46
107
  ### PRECONDITIONS - BEGIN
@@ -59,6 +120,7 @@ Feature: Test python socket steps
59
120
  | 'host' | '127.0.0.1' |
60
121
  | 'port' | PORT |
61
122
  | 'separator' | b'\n' |
123
+ | 'blocking' | False |
62
124
 
63
125
  Given end preconditions
64
126
  ### PRECONDITIONS - END
@@ -72,7 +134,7 @@ Feature: Test python socket steps
72
134
  When write message b'\x11\x21' (socket: CLIENT)
73
135
 
74
136
  # Verify received messages
75
- When wait socket CLIENT stops to receive messages (window: 0.1 s)
137
+ When await socket CLIENT receives messages (window: 0.1 s)
76
138
  When MESSAGES = received messages (socket: CLIENT)
77
139
  Then MESSAGES is list
78
140
  | b'\x01\x02' |