blob: 7e1c72ad68f9c2038687dd3ee21a2bdfdb54bf15 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
require 'test_helper'
class WebfingerControllerTest < ActionController::TestCase
test "get host meta xml" do
get :host_meta, :format => :xml
assert_response :success
assert_equal "application/xml", response.content_type
end
test "get host meta json" do
get :host_meta, :format => :json
assert_response :success
assert_equal "application/json", response.content_type
end
test "get user webfinger xml" do
key = 'my public key'
@user = stub_record :user, :public_key => key
User.stubs(:find_by_login).with(@user.login).returns(@user)
get :search, :q => @user.email_address.to_s, :format => :xml
assert_response :success
assert_equal "application/xml", response.content_type
assert_includes response.body, Base64.encode64(key)
end
test "get user webfinger json" do
@user = stub_record :user, :public_key => 'my public key'
User.stubs(:find_by_login).with(@user.login).returns(@user)
get :search, :q => @user.email_address.to_s, :format => :json
assert_response :success
assert_equal "application/json", response.content_type
end
end
|