def METHOD_NAME(self):
    app = flask.Flask(__name__)
    app.config.update(
        SERVER_NAME='localhost.localdomain:5000'
    )
    @app.route('/')
    def index():
        return None
    @app.route('/', subdomain='foo')
    def sub():
        return None
    with app.test_request_context('/'):
        self.assert_equal(flask.url_for('index', _external=True), 'http://localhost.localdomain:5000/')
    with app.test_request_context('/'):
        self.assert_equal(flask.url_for('sub', _external=True), 'http://foo.localhost.localdomain:5000/')
    try:
        with app.test_request_context('/', environ_overrides={'HTTP_HOST': 'localhost'}):
            pass
    except Exception as e:
        self.assert_true(isinstance(e, ValueError))
        self.assert_equal(str(e), "the server name provided " +
                "('localhost.localdomain:5000') does not match the " + \
                "server name from the WSGI environment ('localhost')")
    try:
        app.config.update(SERVER_NAME='localhost')
        with app.test_request_context('/', environ_overrides={'SERVER_NAME': 'localhost'}):
            pass
    except ValueError as e:
        raise ValueError(
            "No ValueError exception should have been raised \"%s\"" % e
        )
    try:
        app.config.update(SERVER_NAME='localhost:80')
        with app.test_request_context('/', environ_overrides={'SERVER_NAME': 'localhost:80'}):
            pass
    except ValueError as e:
        raise ValueError(
            "No ValueError exception should have been raised \"%s\"" % e
        )