def METHOD_NAME(self, settings):
    settings_file = six.StringIO()
    settings_path_mock = Mock(
        is_file=Mock(return_value=False),
        open=Mock(return_value=Mock(
            __exit__=lambda *args: None, __enter__=lambda *args: settings_file)))
    settings.user_dir = Mock(joinpath=Mock(return_value=settings_path_mock))
    settings._init_settings_file()
    settings_file_contents = settings_file.getvalue()
    assert settings_path_mock.is_file.call_count == 1
    assert settings_path_mock.open.call_count == 1
    assert const.SETTINGS_HEADER in settings_file_contents
    for setting in const.DEFAULT_SETTINGS.items():
        assert '# {} = {}\n'.format(*setting) in settings_file_contents
    settings_file.close()