<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>shiba_yu36</author_name>
  <author_url>https://blog.hatena.ne.jp/shiba_yu36/</author_url>
  <blog_title>$shibayu36-&gt;blog;</blog_title>
  <blog_url>https://blog.shibayu36.org/</blog_url>
  <categories>
    <anon>perl</anon>
    <anon>tech</anon>
  </categories>
  <description>テストをするときに外部のAPIを叩く部分のテストを書きたい場合、出来る限り外部にアクセスせずにテストを書きたい。そういう時 Test::Mock::Guardを使って該当部分のメソッドが特定のデータを返すように書き換えてしまう LWP::Protocol::PSGIを使うなど、APIを叩くclient部分を差し替える Test::TCPを使って、APIのserver部分を差し替える などの方法がある。 今回はLWP::Protocol::PSGIを使ってAPIを叩くclient部分を差し替えるというのをやってみた。 テストしたい実装 例えばはてなブックマーク件数取得APIを使った実装があるとす…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog.shibayu36.org%2Fentry%2F2014%2F02%2F03%2F213754&quot; title=&quot;LWP::Protocol::PSGIを使ってAPIを叩くメソッドのテストを書く - $shibayu36-&amp;gt;blog;&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2014-02-03 21:37:54</published>
  <title>LWP::Protocol::PSGIを使ってAPIを叩くメソッドのテストを書く</title>
  <type>rich</type>
  <url>https://blog.shibayu36.org/entry/2014/02/03/213754</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
