test/mambanation_test.rb in mambanation-0.0.3 vs test/mambanation_test.rb in mambanation-0.0.5
- old
+ new
@@ -1,82 +1,5 @@
require File.dirname(__FILE__) + '/test_helper'
class MambaNationTest < Test::Unit::TestCase
- context "mambanation_base_api" do
-
- setup do
- @username = "website"
- @password = "mambanation"
- httpauth = MambaNation::HTTPAuth.new(@username, @password,:api_endpoint => "api.slot5.dev.mambanation.com"+'/'+"v2")
- @mambanation = MambaNation::Base.new(httpauth)
- end
-
- should "have user method for base authenticated calls to get a user's information" do
- stub_get("http://#{@username}:#{@password}@api.slot5.dev.mambanation.com/v2/users/4.json",'user.json')
- user = @mambanation.user 4
- user.mamba_level.should == 1
- user.email.should == "tian.jiang01@gmail.com"
- end
- should "have facet method for base authenticated calls to get a facet's information" do
- stub_get("http://#{@username}:#{@password}@api.slot5.dev.mambanation.com/v2/facets/1.json",'facet.json')
- facet = @mambanation.facet 1
- facet.user_id.should == 1
- end
-
- should "have user_facets method with given user for base authenticated calls to get a user's facet's information" do
- stub_get("http://#{@username}:#{@password}@api.slot5.dev.mambanation.com/v2/users/5/facets.json",'facets.json')
- facets = @mambanation.user_facets(5)
- facets.facets.count.should == 1
- facets.facebook_id == nil
- end
-
-
- should "have user_friends method with given user for base authenticated calls to get a user's facet's information" do
- stub_get("http://#{@username}:#{@password}@api.slot5.dev.mambanation.com/v2/users/5/friends.json",'friends.json')
- friends = @mambanation.user_friends(5)
- friends.count.should == 2
- end
-
-
- #media api for user in sdk is not rest
- #should "have user_media method with given user for base authenticated calls to get a user's media's information" do
- # stub_get("http://#{@username}:#{@password}@api.slot5.dev.mambanation.com/v2/users/5/medias.json",'')
- # media
- #end
-
- #user_set_websession no more in sdk
-# should "be able to update websession for a user"
-# stub_post("http://#{@username}:#{@password}@api.slot5.dev.mambanation.com/v2/facets/1.json",'')
-# end
-
- should "be able to create a user" do
- stub_post("http://#{@username}:#{@password}@api.slot5.dev.mambanation.com/v2/users",'new_user_status.json')
- response = @mambanation.create_user("user"=>{"email"=>"foofoo@gmail.com","password"=>"foofoo","password_confirmation"=>"foofoo"})
- response.status.should == "ok"
- end
-
-
- should "be able to create a user with a facebook_id" do
- stub_post("http://#{@username}:#{@password}@api.slot5.dev.mambanation.com/v2/users",'new_user_status.json')
- response = @mambanation.create_user("user"=>{"facebook_id"=>"1474761574"})
- response.status.should == "ok"
- end
-
- should "have user find by an existed facebook_id" do
- stub_get("http://#{@username}:#{@password}@api.slot5.dev.mambanation.com/v2/users/find_by?facebook_id=1474761574",'user.json')
- user = @mambanation.user_by_facebook_id 1474761574
- user.mamba_level.should == 1
- user.email.should == "tian.jiang01@gmail.com"
- user.facebook_id.should == 1474761574
- end
-
-
- should "have not found message by an no existed facebook_id" do
- stub_get("http://#{@username}:#{@password}@api.slot5.dev.mambanation.com/v2/users/find_by?facebook_id=12345",'not_found_user.json')
- user = @mambanation.user_by_facebook_id 12345
- user.message.should == "I can't find this user !"
- end
-
-
- end
end