Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 193
- Log:
First stage commit of Typo 4.1, modified for the ROOL site.
Includes all local modifications but a final pass needs to be
made to delete any files left over from earlier Typo versions
that shouldn't be here anymore. See the 'tags' section of the
repository for a clean Typo 4.1 tree.Note that symlinks to shared files in the RISC OS Open theme
directory have been deliberately included this time around; I
decided that on balance it was better to leave them in as
placeholders, since unlike symlinks in app/views/shared, the
Typo theme structure is not a standard Rails concept.
- Author:
- rool
- Date:
- Wed Apr 04 18:51:02 +0100 2007
- Size:
- 3943 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 test_ping_sent_on_save |
37 | Net::HTTP.next_response = self |
38 | |
39 | art = Blog.default.articles.build \ |
40 | :body => %{<link rel="pingback" href="http://anotherblog.org/xml-rpc" />}, |
41 | :title => 'Test the pinging', |
42 | :published => true |
43 | assert art.save |
44 | sent_ping = XMLRPC::Client.pings.last |
45 | assert art.just_published? |
46 | art.reload |
47 | assert !art.just_published? |
48 | end |
49 | |
50 | def assert_pingback_sent |
51 | Net::HTTP.next_response = self |
52 | ping = contents(:article1).pings.build("url" => |
53 | "http://anotherblog.org/a-post") |
54 | |
55 | ping.send_pingback_or_trackback("http://myblog.net/referring-post") |
56 | |
57 | sent_ping = XMLRPC::Client.pings.last |
58 | assert_equal "http://anotherblog.org/xml-rpc", sent_ping.uri |
59 | assert_equal "pingback.ping", sent_ping.method_name |
60 | assert_equal "http://myblog.net/referring-post", sent_ping.args[0] |
61 | assert_equal "http://anotherblog.org/a-post", sent_ping.args[1] |
62 | end |
63 | |
64 | def test_send_trackback |
65 | |
66 | # We've linked to http://anotherblog.org/a-post from |
67 | # http://myblog.net/referring-post and discovered the trackback |
68 | # URL http://anotherblog.org/a-post/trackback |
69 | Net::HTTP.next_response = self |
70 | |
71 | @body = <<-eobody |
72 | <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
73 | xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" |
74 | xmlns:dc="http://purl.org/dc/elements/1.1/"> |
75 | <rdf:Description |
76 | rdf:about="" |
77 | trackback:ping="http://anotherblog.org/a-post/trackback" |
78 | dc:title="Track me, track me!" |
79 | dc:identifier="http://anotherblog.org/a-post" |
80 | dc:description="Track me 'til I fart!'" |
81 | dc:creator="pdcawley" |
82 | dc:date="2006-03-01T04:31:00-05:00" /> |
83 | </rdf:RDF> |
84 | eobody |
85 | |
86 | ping = contents(:article1).pings.build("url" => |
87 | "http://anotherblog.org/a-post") |
88 | ping.send_pingback_or_trackback("http://myblog.net/referring-post") |
89 | |
90 | ping = Net::HTTP.pings.last |
91 | assert_equal "anotherblog.org", ping.host |
92 | assert_equal 80, ping.port |
93 | assert_equal "/a-post/trackback", ping.query |
94 | assert_equal "title=Article+1%21&excerpt=body&url=http://myblog.net/referring-post&blog_name=test+blog", ping.post_data |
95 | end |
96 | |
97 | def test_send_weblogupdatesping |
98 | |
99 | # Our blog, named this_blog.blog_name at http://myblog.net/ has |
100 | # changed through us posting http://myblog.net/new-post. This, |
101 | # we'd like to tell to http://rpc.technorati.com/rpc/ping. |
102 | |
103 | ping = contents(:article1).pings.build("url" => |
104 | "http://rpc.technorati.com/rpc/ping") |
105 | ping.send_weblogupdatesping("http://myblog.net/", |
106 | "http://myblog.net/new-post") |
107 | |
108 | ping = XMLRPC::Client.pings.last |
109 | assert_equal "http://rpc.technorati.com/rpc/ping", ping.uri |
110 | assert_equal "weblogUpdates.ping", ping.method_name |
111 | assert_equal this_blog.blog_name, ping.args[0] |
112 | assert_equal "http://myblog.net/", ping.args[1] |
113 | assert_equal "http://myblog.net/new-post", ping.args[2] |
114 | end |
115 | |
116 | # Mock stuff |
117 | |
118 | def [](key) |
119 | @pingback_header |
120 | end |
121 | |
122 | def body |
123 | @body |
124 | end |
125 | end |