@@ -152,15 +152,20 @@ def test_{{ method_name }}_non_empty_request_with_auto_populated_field():
152152{% for auto_populated_field in method_settings .auto_populated_fields %}
153153 # Ensure that the uuid4 field is set according to AIP 4235
154154 assert re.match(r"{{ get_uuid4_re() }}", args[0].{{ auto_populated_field }})
155- # clear UUID field so that the check below succeeds
156- args[0].{{ auto_populated_field }} = None
157155{% endfor %}
158156{% endif %} {# if method_settings is not none #}
159157{% endwith %} {# method_settings #}
160158 assert args[0] == {{ method.input.ident }}(
161159 {% for field in method .input .fields .values () if field .ident |string () == "str" and not field .uuid 4 %}
162160 {{ field.name }}={{ field.mock_value }},
163161 {% endfor %}
162+ {% with method_settings = api .all_method_settings .get (method .meta .address .proto ) %}
163+ {% if method_settings is not none %}
164+ {% for auto_populated_field in method_settings .auto_populated_fields %}
165+ {{ auto_populated_field }}=mock.ANY,
166+ {% endfor %}
167+ {% endif %}
168+ {% endwith %}
164169 )
165170{% endif %}
166171
@@ -1577,16 +1582,21 @@ def test_{{ method_name }}_rest_no_http_options():
15771582 {% for auto_populated_field in method_settings .auto_populated_fields %}
15781583 # Ensure that the uuid4 field is set according to AIP 4235
15791584 assert re.match(r"{{ get_uuid4_re() }}", args[0].{{ auto_populated_field }})
1580- # clear UUID field so that the check below succeeds
1581- args[0].{{ auto_populated_field }} = None
15821585 {% endfor %} {# for auto_populated_field in method_settings.auto_populated_fields #}
15831586 {% endif %} {# if method_settings is not none #}
15841587 {% endwith %} {# method_settings #}
15851588 {% if request_dict %}
15861589 request_msg = {{ method.input.ident }}(**{{ request_dict }})
15871590 {% else %}
15881591 request_msg = {{ method.input.ident }}()
1589- {% endif %} {# request_dict #}
1592+ {% endif %} {# request_dict #}
1593+ {% with method_settings = api .all_method_settings .get (method .meta .address .proto ) %}
1594+ {% if method_settings is not none %}
1595+ {% for auto_populated_field in method_settings .auto_populated_fields %}
1596+ request_msg.{{ auto_populated_field }} = mock.ANY
1597+ {% endfor %}
1598+ {% endif %}
1599+ {% endwith %}
15901600 assert args[0] == request_msg
15911601
15921602 {% if routing_param %}
0 commit comments