The stuff here should be put in a prepost method and all the applied changes should be reverted at app teardown.
prepost