From ef53840cd3ff4d207981b75e7646561c1b403bd9 Mon Sep 17 00:00:00 2001 From: Kouhei Sutou Date: Mon, 5 Jul 2010 19:42:52 +0800 Subject: [PATCH] add a test for discovering from UTF-8 HTML. --- test/data/test_discover/openid_utf8.html | 11 +++++++++++ test/test_discover.rb | 14 ++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 test/data/test_discover/openid_utf8.html diff --git a/test/data/test_discover/openid_utf8.html b/test/data/test_discover/openid_utf8.html new file mode 100644 index 00000000..c98001af --- /dev/null +++ b/test/data/test_discover/openid_utf8.html @@ -0,0 +1,11 @@ + + + + Identity Page for Smoker + + + + +

こんにちは

+ + diff --git a/test/test_discover.rb b/test/test_discover.rb index 13b115ce..71511c3e 100644 --- a/test/test_discover.rb +++ b/test/test_discover.rb @@ -369,6 +369,20 @@ def test_html1And2 } end + def test_html_utf8 + utf8_html = read_data_file('test_discover/openid_utf8.html', false) + utf8_html.force_encoding("UTF-8") if utf8_html.respond_to?(:force_encoding) + services = _discover('text/html', utf8_html, 1) + + _checkService(services[0], + "http://www.myopenid.com/server", + @id_url, + 'http://smoker.myopenid.com/', + nil, + ['1.1'], + false) + end + def test_yadisEmpty services = _discover('application/xrds+xml', read_data_file('test_discover/yadis_0entries.xml', false),