Esempio n. 1
0
 def test_echo_model_with_nested_defaults_override(self):
     model = {"my_foo": "foo", "my_bar": "bar"}
     request = self.request_generator.generate_request(
         command="echo_model_with_nested_defaults",
         parameters={"model": model})
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response, output=json.dumps(model))
Esempio n. 2
0
 def test_dictionary_no_model_valid_type(self):
     request = self.request_generator.generate_request(
         command="echo_raw_dictionary", parameters={"d": {
             "foo": "bar"
         }})
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response, output=json.dumps({"foo": "bar"}))
Esempio n. 3
0
 def test_say_specific_non_strict_out_of_choice(self):
     request = self.request_generator.generate_request(
         command="say_specific_non_strict_typeahead",
         parameters={"message": "NOT_IN_CHOICE"},
     )
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response, output="NOT_IN_CHOICE")
Esempio n. 4
0
 def test_say_custom_string_and_loud(self):
     request = self.request_generator.generate_request(parameters={
         "message": "test_string",
         "loud": True
     })
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response, output="test_string!!!!!!!!!")
Esempio n. 5
0
 def test_echo_required_message_nullable_true_with_default_no_key(self):
     request = self.request_generator.generate_request(
         command="echo_required_message_nullable_true_with_non_null_default",
         parameters={},
     )
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response, output="can be null")
Esempio n. 6
0
 def test_echo_optional_message_nullable_true_non_null_default_none(self):
     request = self.request_generator.generate_request(
         command="echo_optional_message_nullable_true_non_default",
         parameters={"message": None},
     )
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response, output="null")
Esempio n. 7
0
 def test_echo_list_of_strings_with_choices_repeat_values(self):
     request = self.request_generator.generate_request(
         command="echo_list_of_strings_with_choices",
         parameters={"list_of_s": ["a", "a"]},
     )
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response, output=json.dumps(["a", "a"]))
Esempio n. 8
0
 def test_echo_list_of_booleans_with_minimum_good(self):
     request = self.request_generator.generate_request(
         command="echo_list_of_booleans_with_minimum",
         parameters={"list_of_b": [True, False]},
     )
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response, output=json.dumps([True, False]))
Esempio n. 9
0
 def test_echo_required_any_message(self):
     request = self.request_generator.generate_request(
         command="echo_required_any_message",
         parameters={"message": {
             "foo": "bar"
         }})
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response, output=json.dumps({"foo": "bar"}))
Esempio n. 10
0
 def test_prove_env(self):
     request = self.request_generator.generate_request(command="prove_env")
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response)
     assert {
         "DB_NAME": "complex",
         "DB_PASS": "******"
     } == json.loads(response.output)
Esempio n. 11
0
 def test_parent_with_children_success(self):
     request = self.request_generator.generate_request(command="say_sleep", parameters={"message": "foo",
                                                                                        "amount": 0.01})
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response)
     assert len(response.children) == 2
     for child_request in response.children:
         assert_successful_request(child_request)
Esempio n. 12
0
 def test_echo_model_with_nested_defaults_nothing_provided(self):
     request = self.request_generator.generate_request(
         command="echo_model_with_nested_defaults")
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response,
                               output=json.dumps({
                                   "my_foo": "clientFooValue",
                                   "my_bar": "clientBarValue"
                               }))
Esempio n. 13
0
 def test_echo_optional_multi_nullable_model_with_both_defaults(self):
     request = self.request_generator.generate_request(
         command="echo_optional_multi_nullable_model_with_both_defaults")
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response)
     assert [{
         'my_foo': 'foo',
         'my_bar': 'bar'
     }] == json.loads(response.output)
Esempio n. 14
0
 def test_echo_optional_multi_nullable_model_with_multi_defaults(self):
     request = self.request_generator.generate_request(
         command="echo_optional_multi_nullable_model_with_multi_defaults")
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response)
     assert [{
         'my_nested_string': 'hi',
         'my_nested_int': 2
     }] == json.loads(response.output)
Esempio n. 15
0
 def test_echo_simple_model_with_default(self):
     request = self.request_generator.generate_request(
         command="echo_simple_model_with_default")
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response)
     assert {
         "my_nested_string": "foo",
         "my_nested_int": 1
     } == json.loads(response.output)
Esempio n. 16
0
 def test_echo_required_any_multi_message(self):
     request = self.request_generator.generate_request(
         command="echo_required_any_multi_message",
         parameters={"messages": [{
             'foo': 'bar'
         }]})
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response)
     assert [{'foo': 'bar'}] == json.loads(response.output)
Esempio n. 17
0
 def test_echo_optional_multi_nullable_model_with_model_defaults(self):
     request = self.request_generator.generate_request(
         command="echo_optional_multi_nullable_model_with_model_defaults",
         parameters={"param": [{}]})
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response)
     assert [{
         'my_foo': 'defaultFooFromModel',
         'my_bar': 'defaultBarFromModel'
     }] == json.loads(response.output)
Esempio n. 18
0
 def test_parent_with_error_and_raise(self):
     request = self.request_generator.generate_request(command="say_error_and_raise", parameters={"message": "foo"})
     response = wait_for_response(self.easy_client, request)
     assert_errored_request(response)
     assert len(response.children) == 2
     for child_request in response.children:
         if child_request.system == "echo":
             assert_successful_request(child_request)
         elif child_request.system == "error":
             assert_errored_request(child_request)
Esempio n. 19
0
 def test_echo_optional_model_with_defaults_empty_model(self):
     request = self.request_generator.generate_request(
         command="echo_optional_model_with_defaults",
         parameters={"model": {}})
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response,
                               output=json.dumps({
                                   "my_foo":
                                   "defaultFooFromModel",
                                   "my_bar":
                                   "defaultBarFromModel"
                               }))
Esempio n. 20
0
 def test_echo_optional_multi_nullable_model_with_partial_default_provided(
         self):
     parameters = {'param': [{"my_foo": "foo_from_client"}]}
     request = self.request_generator.generate_request(
         command="echo_optional_multi_nullable_model_with_both_defaults",
         parameters=parameters)
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response)
     assert [{
         'my_foo': 'foo_from_client',
         'my_bar': 'defaultBarFromModel'
     }] == json.loads(response.output)
Esempio n. 21
0
 def test_echo_model(self):
     parameters = {
         "model": {
             "my_string":
             "my_string",
             "my_string_with_choices":
             "A",
             "my_int":
             1,
             "my_float":
             1.2,
             "my_bool":
             True,
             "my_any": ["this", "is", "an", "any"],
             "my_raw_dict": {
                 "foo": "bar",
                 "baz": [1, 2, 3],
                 "null_thing": None,
                 "dict": {
                     "another": "dict"
                 },
                 "ball": 1,
                 "float": 1.2,
                 "bool": False,
             },
             "my_nested_model": {
                 "my_nested_string": "my_nested_string",
                 "my_nested_int": 2,
             },
             "my_list_of_strings": ["a", "b", "c"],
             "my_optional_string":
             "provided_anyway",
             "my_nullable_string":
             None,
             "my_list_of_models": [
                 {
                     "my_list_of_strings":
                     ["more", "list", "of", "strings"],
                     "my_choices_string": "a",
                 },
                 {
                     "my_list_of_strings":
                     ["more", "list", "of", "strings2"],
                     "my_choices_string": "b",
                 },
             ],
         }
     }
     request = self.request_generator.generate_request(
         command="echo_model", parameters=parameters)
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response)
     assert parameters["model"] == json.loads(response.output)
Esempio n. 22
0
 def test_echo_list_model(self):
     parameters = {
         "model": {
             "my_list_of_strings": ["a", "b", "c"],
             "my_choices_string": "a"
         }
     }
     request = self.request_generator.generate_request(
         command="echo_list_model", parameters=parameters)
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response)
     assert parameters['model'] == json.loads(response.output)
Esempio n. 23
0
 def test_echo_model(self):
     parameters = {
         'model': {
             'my_string':
             'my_string',
             'my_string_with_choices':
             'A',
             'my_int':
             1,
             'my_float':
             1.2,
             'my_bool':
             True,
             'my_any': ["this", "is", "an", "any"],
             'my_raw_dict': {
                 "foo": "bar",
                 "baz": [1, 2, 3],
                 "null_thing": None,
                 "dict": {
                     "another": "dict"
                 },
                 "ball": 1,
                 "float": 1.2,
                 "bool": False
             },
             'my_nested_model': {
                 'my_nested_string': "my_nested_string",
                 'my_nested_int': 2
             },
             'my_list_of_strings': ['a', 'b', 'c'],
             'my_optional_string':
             'provided_anyway',
             'my_nullable_string':
             None,
             'my_list_of_models': [
                 {
                     'my_list_of_strings':
                     ['more', 'list', 'of', 'strings'],
                     "my_choices_string": "a"
                 },
                 {
                     'my_list_of_strings':
                     ['more', 'list', 'of', 'strings2'],
                     "my_choices_string": "b"
                 },
             ]
         }
     }
     request = self.request_generator.generate_request(
         command="echo_model", parameters=parameters)
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response)
     assert parameters['model'] == json.loads(response.output)
Esempio n. 24
0
 def test_echo_optional_any_multi_message_with_default(self):
     parameters = {
         "messages":
         ["foo", None, {
             "foo": "bar"
         }, 1, 1.2, ["a", "b", "c"], True]
     }
     request = self.request_generator.generate_request(
         command="echo_optional_any_multi_message_with_default",
         parameters=parameters)
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response)
     assert json.loads(response.output) == parameters['messages']
Esempio n. 25
0
 def test_echo_optional_multi_nullable_model_list_provided(self):
     parameters = {
         'param': [{
             "my_nested_string": "str1",
             "my_nested_int": 1
         }]
     }
     request = self.request_generator.generate_request(
         command="echo_optional_multi_nullable_model",
         parameters=parameters)
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response)
     assert parameters['param'] == json.loads(response.output)
Esempio n. 26
0
 def test_echo_model_with_nested_defaults_partial_fallback_to_model(self):
     model = {"my_foo": "foo"}
     request = self.request_generator.generate_request(
         command="echo_model_with_nested_defaults",
         parameters={"model": model})
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response,
                               output=json.dumps({
                                   "my_foo":
                                   "foo",
                                   "my_bar":
                                   "defaultBarFromModel"
                               }))
Esempio n. 27
0
 def test_weird_parameters(self):
     parameters = {
         "system": "system_value",
         "command": "command_value",
         "comment": "comment_value",
         "system_version": "system_version_value",
         "instance_name": "instance_name_value",
         "parameters": ["parameters_value"]
     }
     request = self.request_generator.generate_request(
         command="weird_parameter_names", parameters=parameters)
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response)
     assert parameters == json.loads(response.output)
Esempio n. 28
0
 def test_echo_simple_model(self):
     request = self.request_generator.generate_request(
         command="echo_simple_model",
         parameters={
             "model": {
                 "my_nested_string": "str1",
                 "my_nested_int": 1
             }
         })
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response)
     assert {
         "my_nested_string": "str1",
         "my_nested_int": 1
     } == json.loads(response.output)
Esempio n. 29
0
 def test_echo_model_simple_list(self):
     parameters = {
         'models': [{
             'my_nested_string': "foo",
             "my_nested_int": 1
         }, {
             'my_nested_string': "bar",
             "my_nested_int": 2
         }, {
             'my_nested_string': "baz",
             "my_nested_int": 3
         }]
     }
     request = self.request_generator.generate_request(
         command="echo_model_simple_list", parameters=parameters)
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response)
     assert parameters['models'] == json.loads(response.output)
Esempio n. 30
0
 def test_say_no_parameters_provided(self):
     request = self.request_generator.generate_request()
     response = wait_for_response(self.easy_client, request)
     assert_successful_request(response, output="Hello, World!")