Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 71
- Log:
Start of upgrade to Typo 4.0.0, the latest stable release since
2.6.0. Note test/mocks/themes/azure changes from a file to a
directory, so the file has been removed in this revision and
the directory will be added in the next revision.
- Author:
- adh
- Date:
- Mon Aug 07 22:18:11 +0100 2006
- Size:
- 3549 Bytes
1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | |
3 | require 'http_mock' |
4 | require 'xmlrpc_mock' |
5 | |
6 | class PingTest < Test::Unit::TestCase |
7 | fixtures :contents, :blogs |
8 | |
9 | def setup |
10 | @pingback_header = nil |
11 | @body = '' |
12 | end |
13 | |
14 | def teardown |
15 | Net::HTTP.next_response = nil |
16 | end |
17 | |
18 | def test_send_pingback_found_in_pingback_header |
19 | |
20 | # We've linked to http://anotherblog.org/a-post from |
21 | # http://myblog.net/referring-post and discovered a pingback |
22 | # listener at http://anotherblog.org/xml-rpc |
23 | # Set up the mocking |
24 | |
25 | |
26 | @pingback_header = "http://anotherblog.org/xml-rpc" |
27 | assert_pingback_sent |
28 | end |
29 | |
30 | def test_send_pingback_found_in_body |
31 | @body = %{<link rel="pingback" href="http://anotherblog.org/xml-rpc" />} |
32 | |
33 | assert_pingback_sent |
34 | end |
35 | |
36 | def assert_pingback_sent |
37 | Net::HTTP.next_response = self |
38 | ping = contents(:article1).pings.build("url" => |
39 | "http://anotherblog.org/a-post") |
40 | |
41 | ping.send_pingback_or_trackback("http://myblog.net/referring-post") |
42 | |
43 | sent_ping = XMLRPC::Client.pings.last |
44 | assert_equal "http://anotherblog.org/xml-rpc", sent_ping.uri |
45 | assert_equal "pingback.ping", sent_ping.method_name |
46 | assert_equal "http://myblog.net/referring-post", sent_ping.args[0] |
47 | assert_equal "http://anotherblog.org/a-post", sent_ping.args[1] |
48 | end |
49 | |
50 | def test_send_trackback |
51 | |
52 | # We've linked to http://anotherblog.org/a-post from |
53 | # http://myblog.net/referring-post and discovered the trackback |
54 | # URL http://anotherblog.org/a-post/trackback |
55 | Net::HTTP.next_response = self |
56 | |
57 | @body = <<-eobody |
58 | <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
59 | xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" |
60 | xmlns:dc="http://purl.org/dc/elements/1.1/"> |
61 | <rdf:Description |
62 | rdf:about="" |
63 | trackback:ping="http://anotherblog.org/a-post/trackback" |
64 | dc:title="Track me, track me!" |
65 | dc:identifier="http://anotherblog.org/a-post" |
66 | dc:description="Track me 'til I fart!'" |
67 | dc:creator="pdcawley" |
68 | dc:date="2006-03-01T04:31:00-05:00" /> |
69 | </rdf:RDF> |
70 | eobody |
71 | |
72 | ping = contents(:article1).pings.build("url" => |
73 | "http://anotherblog.org/a-post") |
74 | ping.send_pingback_or_trackback("http://myblog.net/referring-post") |
75 | |
76 | ping = Net::HTTP.pings.last |
77 | assert_equal "anotherblog.org", ping.host |
78 | assert_equal 80, ping.port |
79 | assert_equal "/a-post/trackback", ping.query |
80 | assert_equal "title=Article+1%21&excerpt=body&url=http://myblog.net/referring-post&blog_name=test+blog", ping.post_data |
81 | end |
82 | |
83 | def test_send_weblogupdatesping |
84 | |
85 | # Our blog, named this_blog.blog_name at http://myblog.net/ has |
86 | # changed through us posting http://myblog.net/new-post. This, |
87 | # we'd like to tell to http://rpc.technorati.com/rpc/ping. |
88 | |
89 | ping = contents(:article1).pings.build("url" => |
90 | "http://rpc.technorati.com/rpc/ping") |
91 | ping.send_weblogupdatesping("http://myblog.net/", |
92 | "http://myblog.net/new-post") |
93 | |
94 | ping = XMLRPC::Client.pings.last |
95 | assert_equal "http://rpc.technorati.com/rpc/ping", ping.uri |
96 | assert_equal "weblogUpdates.ping", ping.method_name |
97 | assert_equal this_blog.blog_name, ping.args[0] |
98 | assert_equal "http://myblog.net/", ping.args[1] |
99 | assert_equal "http://myblog.net/new-post", ping.args[2] |
100 | end |
101 | |
102 | # Mock stuff |
103 | |
104 | def [](key) |
105 | @pingback_header |
106 | end |
107 | |
108 | def body |
109 | @body |
110 | end |
111 | end |