Sha256: 16aabaed2a6d2834bfbb5151ecad0ade11b0007bc52d39ee30860285902d639a

Contents?: true

Size: 1.83 KB

Versions: 5

Compression:

Stored size: 1.83 KB

Contents

$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
require 'pho'
require 'test/unit'
require 'mocha'

class SearchTest < Test::Unit::TestCase
  
  def test_simple_search
    mc = mock()
    mc.stub_everything()
    mc.expects(:get).with("http://api.talis.com/stores/testing/items", {"query" => "lunar"}, nil)
    
    store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
    s = store.search("lunar")       
  end
  
  def test_parameter_search
    mc = mock()
    mc.stub_everything()
    mc.expects(:get).with("http://api.talis.com/stores/testing/items", {"query" => "lunar", "max" => "50", "offset" => "10"}, nil)
    
    store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
    s = store.search("lunar", {"max" => "50", "offset" => "10"})          
  end
  
  def test_facet
    mc = mock()
    mc.expects(:set_auth)
    mc.expects(:get).with("http://api.talis.com/stores/testing/services/facet", {"query" => "lunar", "fields" => "name,agency"}, nil)
    
    store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
    s = store.facet("lunar", ["name", "agency"] )
  end
  
  def test_augment_uri
    mc = mock()
    mc.expects(:set_auth)
    mc.expects(:get).with("http://api.talis.com/stores/testing/services/augment", {"data-uri" => "http://www.example.org/index.rss"}, nil)
      
     
    store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
    response = store.augment_uri("http://www.example.org/index.rss")    
  end
  
  def test_augment
     mc = mock()
     mc.expects(:set_auth)
     mc.expects(:post).with("http://api.talis.com/stores/testing/services/augment", "data", nil)
     
    store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
    response = store.augment("data")    
              
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pho-0.1 tests/tc_search.rb
pho-0.2 tests/tc_search.rb
pho-0.3 tests/tc_search.rb
pho-0.4 tests/tc_search.rb
pho-0.0.1 tests/tc_search.rb