Fix apache_module states to return None and changes dict in test mode

Fixes #16953.