require "helper"

describe Picasa::Presenter::Photo do
  def setup
    # TODO: find a way to retrieve this from cassettes
    @data = {"xmlns$exif"=>"http://schemas.google.com/photos/exif/2007", "xmlns$app"=>"http://www.w3.org/2007/app", "xmlns"=>"http://www.w3.org/2005/Atom", "xmlns$gphoto"=>"http://schemas.google.com/photos/2007", "xmlns$media"=>"http://search.yahoo.com/mrss/", "xmlns$gd"=>"http://schemas.google.com/g/2005", "gd$etag"=>"\"YD0qeyI.\"", "id"=>{"$t"=>"https://picasaweb.google.com/data/entry/user/106136347770555028022/albumid/5793892606777564353/photoid/5806295577614146146"}, "published"=>{"$t"=>"2012-11-02T19:12:16.000Z"}, "updated"=>{"$t"=>"2012-11-02T19:12:16.566Z"}, "app$edited"=>{"$t"=>"2012-11-02T19:12:16.566Z"}, "category"=>[{"scheme"=>"http://schemas.google.com/g/2005#kind", "term"=>"http://schemas.google.com/photos/2007#photo"}], "title"=>{"$t"=>"Lena"}, "summary"=>{"$t"=>""}, "content"=>{"type"=>"image/jpeg", "src"=>"https://lh5.googleusercontent.com/-k4MaJY-F7Ao/UJQbEJSc2mI/AAAAAAAADvA/oDLr5F6-xho/Lena.jpg"}, "link"=>[{"rel"=>"http://schemas.google.com/g/2005#feed", "type"=>"application/atom+xml", "href"=>"https://picasaweb.google.com/data/feed/api/user/106136347770555028022/albumid/5793892606777564353/photoid/5806295577614146146?alt=json&authkey=Gv1sRgCNmigd3KrbOHLA"}, {"rel"=>"alternate", "type"=>"text/html", "href"=>"https://picasaweb.google.com/106136347770555028022/ThorTesting02?authkey=Gv1sRgCNmigd3KrbOHLA#5806295577614146146"}, {"rel"=>"http://schemas.google.com/photos/2007#canonical", "type"=>"text/html", "href"=>"https://picasaweb.google.com/lh/photo/uzMvHBCIb3kHVheiGO2QCCUdvMQllM3aC4Soztgbiog"}, {"rel"=>"self", "type"=>"application/atom+xml", "href"=>"https://picasaweb.google.com/data/entry/api/user/106136347770555028022/albumid/5793892606777564353/photoid/5806295577614146146?alt=json&authkey=Gv1sRgCNmigd3KrbOHLA"}, {"rel"=>"edit", "type"=>"application/atom+xml", "href"=>"https://picasaweb.google.com/data/entry/api/user/106136347770555028022/albumid/5793892606777564353/photoid/5806295577614146146?authkey=Gv1sRgCNmigd3KrbOHLA"}, {"rel"=>"edit-media", "type"=>"image/jpeg", "href"=>"https://picasaweb.google.com/data/media/api/user/106136347770555028022/albumid/5793892606777564353/photoid/5806295577614146146?authkey=Gv1sRgCNmigd3KrbOHLA"}, {"rel"=>"http://schemas.google.com/photos/2007#report", "type"=>"text/html", "href"=>"https://picasaweb.google.com/lh/reportAbuse?uname=106136347770555028022&aid=5793892606777564353&iid=5806295577614146146"}], "gphoto$id"=>{"$t"=>"5806295577614146146"}, "gphoto$albumid"=>{"$t"=>"5793892606777564353"}, "gphoto$access"=>{"$t"=>"private"}, "gphoto$width"=>{"$t"=>"337"}, "gphoto$height"=>{"$t"=>"720"}, "gphoto$size"=>{"$t"=>"81352"}, "gphoto$checksum"=>{"$t"=>""}, "gphoto$timestamp"=>{"$t"=>"1351883536000"}, "gphoto$imageVersion"=>{"$t"=>"3824"}, "gphoto$commentingEnabled"=>{"$t"=>"true"}, "gphoto$commentCount"=>{"$t"=>0}, "gphoto$license"=>{"$t"=>"ALL_RIGHTS_RESERVED", "id"=>0, "name"=>"Wszelkie prawa zastrzeżone", "url"=>""}, "exif$tags"=>{"exif$imageUniqueID"=>{"$t"=>"8a69034d54f38875a7c44db612085818"}}, "media$group"=>{"media$content"=>[{"url"=>"https://lh5.googleusercontent.com/-k4MaJY-F7Ao/UJQbEJSc2mI/AAAAAAAADvA/oDLr5F6-xho/Lena.jpg", "height"=>512, "width"=>240, "type"=>"image/jpeg", "medium"=>"image"}], "media$credit"=>[{"$t"=>"Wojciech Wnętrzak"}], "media$description"=>{"$t"=>"", "type"=>"plain"}, "media$keywords"=>{}, "media$thumbnail"=>[{"url"=>"https://lh5.googleusercontent.com/-k4MaJY-F7Ao/UJQbEJSc2mI/AAAAAAAADvA/oDLr5F6-xho/s72/Lena.jpg", "height"=>72, "width"=>34}, {"url"=>"https://lh5.googleusercontent.com/-k4MaJY-F7Ao/UJQbEJSc2mI/AAAAAAAADvA/oDLr5F6-xho/s144/Lena.jpg", "height"=>144, "width"=>68}, {"url"=>"https://lh5.googleusercontent.com/-k4MaJY-F7Ao/UJQbEJSc2mI/AAAAAAAADvA/oDLr5F6-xho/s288/Lena.jpg", "height"=>288, "width"=>135}], "media$title"=>{"$t"=>"Lena", "type"=>"plain"}}}
  end

  it "returns nil when no latitude" do
    photo = Picasa::Presenter::Photo.new(@data)

    assert_nil photo.latitude
  end

  it "returns nil when no longitude" do
    photo = Picasa::Presenter::Photo.new(@data)

    assert_nil photo.longitude
  end
end
