Skip to content

Commit b1ee2b9

Browse files
committed
Review update
1 parent cae094c commit b1ee2b9

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

extensions/elasticsearch/tests/features/steps/elasticsearch_container.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,27 @@ def elastic_generate_apikey(self):
6161
api_user = "elastic:password"
6262
api_headers = "Content-Type:application/json"
6363
api_data = (
64-
'{"name":"my-api-key",'
65-
'"expiration":"1d",'
66-
'"role_descriptors":{"role-a": {'
67-
'"cluster": ["all"],'
68-
'"index": [{"names": ["my_index"],"privileges": ["all"]}]'
69-
'}}}'
64+
'{'
65+
' "name": "my-api-key",'
66+
' "expiration": "1d",'
67+
' "role_descriptors": {'
68+
' "role-a": {'
69+
' "cluster": ['
70+
' "all"'
71+
' ],'
72+
' "index": ['
73+
' {'
74+
' "names": ['
75+
' "my_index"'
76+
' ],'
77+
' "privileges": ['
78+
' "all"'
79+
' ]'
80+
' }'
81+
' ]'
82+
' }'
83+
' }'
84+
'}'
7085
)
7186
curl_cmd = (
7287
f"curl -s -u {api_user} -k -XPOST {api_url} "

extensions/elasticsearch/tests/features/steps/steps.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,23 @@ def step_impl(context: MinifiTestContext):
3434
assert context.containers["elasticsearch"].create_doc_elasticsearch("my_index", "preloaded_id") or context.containers["elasticsearch"].log_app_output()
3535

3636

37-
@given(u'an ElasticsearchCredentialsControllerService is set up with Basic Authentication')
37+
@given('an ElasticsearchCredentialsControllerService is set up with Basic Authentication')
3838
def step_impl(context: MinifiTestContext):
3939
controller_service = ControllerService(class_name="ElasticsearchCredentialsControllerService", service_name="ElasticsearchCredentialsControllerService")
4040
controller_service.add_property("Username", "elastic")
4141
controller_service.add_property("Password", "password")
4242
context.get_or_create_default_minifi_container().flow_definition.controller_services.append(controller_service)
4343

4444

45-
@given(u'an ElasticsearchCredentialsControllerService is set up with ApiKey')
45+
@given('an ElasticsearchCredentialsControllerService is set up with ApiKey')
4646
def step_impl(context: MinifiTestContext):
4747
controller_service = ControllerService(class_name="ElasticsearchCredentialsControllerService", service_name="ElasticsearchCredentialsControllerService")
4848
api_key = context.containers["elasticsearch"].elastic_generate_apikey()
4949
controller_service.add_property("API Key", api_key)
5050
context.get_or_create_default_minifi_container().flow_definition.controller_services.append(controller_service)
5151

5252

53-
@then(u'Elasticsearch has a document with "{doc_id}" in "{index}" that has "{value}" set in "{field}"')
53+
@then('Elasticsearch has a document with "{doc_id}" in "{index}" that has "{value}" set in "{field}"')
5454
def step_impl(context: MinifiTestContext, doc_id: str, index: str, value: str, field: str):
5555
assert context.containers["elasticsearch"].check_elastic_field_value(index_name=index, doc_id=doc_id, field_name=field, field_value=value) or log_due_to_failure(context)
5656

@@ -70,7 +70,7 @@ def step_impl(context):
7070
context.containers["opensearch"].create_doc_elasticsearch("my_index", "preloaded_id")
7171

7272

73-
@then(u'Opensearch has a document with "{doc_id}" in "{index}" that has "{value}" set in "{field}"')
73+
@then('Opensearch has a document with "{doc_id}" in "{index}" that has "{value}" set in "{field}"')
7474
def step_impl(context: MinifiTestContext, doc_id: str, index: str, value: str, field: str):
7575
assert context.containers["opensearch"].check_elastic_field_value(index_name=index, doc_id=doc_id, field_name=field, field_value=value) or log_due_to_failure(context)
7676

0 commit comments

Comments
 (0)