There is a lot of common code in these two tests. Can we refactor this for better reuse?