Refactor clunky API POSTs in tests