Updated tests to use factories