Fix deprecation warnings in tests