This commit puts AST validation on the execution path. This means updates get
validated prior to being executed. There were quite a few tests that were not
working against Amazon DDB. These tests I considered broken and as such this
commit adapts them such that they pass against Amazon DDB.
test_update_item_on_map()
=> One of the SET actions would try to set a nested element by specifying the nesting on the path
rather than by putting a map as a value for a non-existent key. This got changed.
test_item_size_is_under_400KB
=> Used the keyword "item" which DDB doesn't like. Change to cont in order to keep the same sizings.
=> Secondly the size error messages differs a bit depending whether it is part of the update or part
of a put_item. For an update it should be:
Item size to update has exceeded the maximum allowed size
otherwise it is
Item size has exceeded the maximum allowed size'
test_remove_top_level_attribute
=> Used a keyword item. Use ExpressionAttributeNames
test_update_item_double_nested_remove
=> Used keywords name & first. Migrated to non-deprecated API and use ExpressionAttributeNames
test_update_item_set &
test_boto3_update_item_conditions_pass &
test_boto3_update_item_conditions_pass_because_expect_not_exists &
test_boto3_update_item_conditions_pass_because_expect_not_exists_by_compare_to_null &
test_boto3_update_item_conditions_pass_because_expect_exists_by_compare_to_not_null &
test_boto3_update_item_conditions_fail &
test_boto3_update_item_conditions_fail_because_expect_not_exists &
test_boto3_update_item_conditions_fail_because_expect_not_exists_by_compare_to_null
=> Were broken tests which had string literal instead of value placeholder
The AWS API represents a set object as a list of values. Internally
moto also represents a set as a list. This means that when we do value
comparisons, the order of the values can cause a set equality test to
fail.
The AWS documentation says that a ComparisonOperator of NULL means
the attribute should not exist, whereas NOT_NULL means that the
attribute should exist. It explicitly says that an attribute with a
value of NULL is considered to exist, which contradicts our previous
implementation. This affects both put_item and get_item in dynamodb2.
https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Condition.html
Update expression has the wrong syntax. Something like :bar denotes a
placeholder which has to be filled by supplying an additional
ExpressionAttributeNames