Seems to be a lot of code duplication on these tests.
Create a separated test for each test scenario (each of the code blocks described by a comment) and then use a parameterized test to change the different payloads