Without checking the interior of `resample_img`, one could check whether `mean_img` actually uses it properly by doing
```
target_affine = affine[:, [1, 0, 2, 3]]  # permutation of axes
mean_img_with_resampling = image.mean_img(niimg, target_affine=target_affine)
resampled_mean_image = resampling.resample_img(mean_img)
assert_array_equal(resampled_mean_image.get_data(), mean_img_with_resampling.get_data())
assert_array_equal(resampled_mean_image.get_affine(), mean_img_with_resampling.get_affine())
assert_array_equal(mean_img_with_resampling.get_affine(), target_affine)
```