refactor the registration test ot use the TestApi class

also add db initialization to the TestApi class