impostor 0.2.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gemtest +0 -0
- data/.gitignore +1 -0
- data/.rspec +2 -0
- data/.rvmrc +1 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +47 -0
- data/History.txt +8 -0
- data/Manifest.txt +87 -55
- data/README.txt +11 -11
- data/Rakefile +16 -20
- data/lib/impostor/auth.rb +103 -0
- data/lib/impostor/config.rb +171 -0
- data/lib/impostor/errors.rb +67 -0
- data/lib/impostor/phpbb2.rb +202 -0
- data/lib/impostor/phpbb3.rb +199 -0
- data/lib/impostor/post.rb +111 -0
- data/lib/impostor/topic.rb +115 -0
- data/lib/impostor/wwf79.rb +186 -0
- data/lib/impostor/wwf80.rb +190 -0
- data/lib/impostor.rb +108 -5
- data/spec/auth_spec.rb +148 -0
- data/spec/base_spec_helper.rb +12 -0
- data/{test/test_helper.rb → spec/caged_net_http.rb} +8 -17
- data/spec/config_spec.rb +136 -0
- data/spec/fixtures/junk.html +1 -0
- data/{test → spec}/fixtures/phpbb2-get-new_topic-form-good-response.html +0 -0
- data/{test → spec}/fixtures/phpbb2-get-viewtopic-for-new-topic-good-response.html +11 -11
- data/{test → spec}/fixtures/phpbb2-get-viewtopic-for-new-topic-malformed-response.html +0 -0
- data/{test → spec}/fixtures/phpbb2-index.html +0 -0
- data/{test → spec}/fixtures/phpbb2-logged-in.html +0 -0
- data/{test → spec}/fixtures/phpbb2-login.html +0 -0
- data/{test → spec}/fixtures/phpbb2-not-logged-in.html +0 -0
- data/{test → spec}/fixtures/phpbb2-post-new_topic-good-response.html +0 -0
- data/{test → spec}/fixtures/phpbb2-post-reply-good-response.html +0 -0
- data/{test → spec}/fixtures/phpbb2-post-reply-throttled-response.html +0 -0
- data/{test → spec}/fixtures/phpbb2-too-many-posts.html +0 -0
- data/{test → spec}/fixtures/phpbb3-get-new-topic-form-good-response.html +0 -0
- data/{test → spec}/fixtures/phpbb3-get-reply-form-good-response.html +0 -0
- data/{test → spec}/fixtures/phpbb3-logged-in.html +0 -0
- data/{test → spec}/fixtures/phpbb3-login.html +0 -0
- data/{test → spec}/fixtures/phpbb3-not-logged-in.html +0 -0
- data/{test → spec}/fixtures/phpbb3-post-new_topic-good-response.html +0 -0
- data/{test → spec}/fixtures/phpbb3-post-reply-good-response.html +0 -0
- data/spec/fixtures/vcr_cassettes/phpbb2-should-be-overlimit-creating-topic.yml +1308 -0
- data/spec/fixtures/vcr_cassettes/phpbb2-should-create-topic.yml +923 -0
- data/spec/fixtures/vcr_cassettes/phpbb2-should-login.yml +360 -0
- data/spec/fixtures/vcr_cassettes/phpbb2-should-not-create-new-topic.yml +497 -0
- data/spec/fixtures/vcr_cassettes/phpbb2-should-not-login.yml +287 -0
- data/spec/fixtures/vcr_cassettes/phpbb2-should-not-post.yml +497 -0
- data/spec/fixtures/vcr_cassettes/phpbb2-should-overlimit-error-post.yml +1140 -0
- data/spec/fixtures/vcr_cassettes/phpbb2-should-post.yml +751 -0
- data/spec/fixtures/vcr_cassettes/phpbb3-should-be-overlimit-creating-topic.yml +995 -0
- data/spec/fixtures/vcr_cassettes/phpbb3-should-create-topic.yml +675 -0
- data/spec/fixtures/vcr_cassettes/phpbb3-should-login.yml +245 -0
- data/spec/fixtures/vcr_cassettes/phpbb3-should-not-create-new-topic.yml +350 -0
- data/spec/fixtures/vcr_cassettes/phpbb3-should-not-login.yml +253 -0
- data/spec/fixtures/vcr_cassettes/phpbb3-should-not-post.yml +350 -0
- data/spec/fixtures/vcr_cassettes/phpbb3-should-overlimit-error-post.yml +1046 -0
- data/spec/fixtures/vcr_cassettes/phpbb3-should-post.yml +605 -0
- data/{test → spec}/fixtures/wwf79-forum_posts.html +0 -0
- data/{test → spec}/fixtures/wwf79-general-new-topic-error.html +0 -0
- data/{test → spec}/fixtures/wwf79-general-posting-error.html +0 -0
- data/{test → spec}/fixtures/wwf79-good-post-forum_posts.html +1 -1
- data/{test → spec}/fixtures/wwf79-index.html +0 -0
- data/{test → spec}/fixtures/wwf79-logged-in.html +0 -0
- data/{test → spec}/fixtures/wwf79-login.html +0 -0
- data/{test → spec}/fixtures/wwf79-new-topic-forum_posts-response.html +0 -0
- data/{test → spec}/fixtures/wwf79-new-topic-post_message_form.html +0 -0
- data/{test → spec}/fixtures/wwf79-not-logged-in.html +0 -0
- data/{test → spec}/fixtures/wwf79-too-many-posts.html +0 -0
- data/{test → spec}/fixtures/wwf79-too-many-topics.html +0 -0
- data/{test → spec}/fixtures/wwf80-general-posting-error.html +0 -0
- data/{test → spec}/fixtures/wwf80-get-new_topic-form-good-response.html +0 -0
- data/{test → spec}/fixtures/wwf80-get-viewtopic-for-new-topic-good-response.html +0 -0
- data/{test → spec}/fixtures/wwf80-index.html +0 -0
- data/{test → spec}/fixtures/wwf80-logged-in.html +0 -0
- data/{test → spec}/fixtures/wwf80-login.html +0 -0
- data/{test → spec}/fixtures/wwf80-new_reply_form.html +0 -0
- data/{test → spec}/fixtures/wwf80-not-logged-in.html +0 -0
- data/{test → spec}/fixtures/wwf80-post-new_topic-good-response.html +1 -1
- data/{test → spec}/fixtures/wwf80-post-reply-good-response.html +0 -0
- data/{test → spec}/fixtures/wwf80-too-many-posts.html +0 -0
- data/spec/impostor_spec_helper.rb +162 -0
- data/spec/integration/phpbb2_spec.rb +111 -0
- data/spec/integration/phpbb3_spec.rb +109 -0
- data/spec/integration_spec_helper.rb +7 -0
- data/spec/phpbb2_spec.rb +346 -0
- data/spec/phpbb3_spec.rb +332 -0
- data/spec/post_spec.rb +134 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/test_impostor.rb +12 -0
- data/spec/topic_spec.rb +143 -0
- data/spec/wwf79_spec.rb +342 -0
- data/spec/wwf80_spec.rb +339 -0
- metadata +156 -87
- data/lib/www/impostor/phpbb2.rb +0 -258
- data/lib/www/impostor/phpbb3.rb +0 -236
- data/lib/www/impostor/wwf79.rb +0 -254
- data/lib/www/impostor/wwf80.rb +0 -264
- data/lib/www/impostor.rb +0 -269
- data/test/test_github.rb +0 -12
- data/test/test_www_impostor.rb +0 -165
- data/test/test_www_impostor_phpbb2.rb +0 -536
- data/test/test_www_impostor_phpbb3.rb +0 -483
- data/test/test_www_impostor_wwf79.rb +0 -535
- data/test/test_www_impostor_wwf80.rb +0 -535
- data/vendor/plugins/impostor/lib/autotest/discover.rb +0 -3
- data/vendor/plugins/impostor/lib/autotest/impostor.rb +0 -49
data/spec/wwf80_spec.rb
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'spec_helper')
|
|
2
|
+
|
|
3
|
+
describe "a Web Wiz Forum 8.0 impostor" do
|
|
4
|
+
|
|
5
|
+
describe "authentication routines" do
|
|
6
|
+
|
|
7
|
+
before do
|
|
8
|
+
@auth = wwf80_auth
|
|
9
|
+
|
|
10
|
+
@login_uri = URI.parse("http://example.com/forum/login_user.asp")
|
|
11
|
+
|
|
12
|
+
@login_page = load_fixture_page(
|
|
13
|
+
"wwf80-login.html",
|
|
14
|
+
@auth.config.login_page, 200, @auth.config.agent
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
@logged_in_page = load_fixture_page(
|
|
18
|
+
"wwf80-logged-in.html",
|
|
19
|
+
@auth.config.app_root, 200, @auth.config.agent
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
@not_logged_in_page = load_fixture_page(
|
|
23
|
+
"wwf80-not-logged-in.html",
|
|
24
|
+
@auth.config.app_root, 200, @auth.config.agent
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
@junk_page = load_fixture_page(
|
|
28
|
+
"junk.html", @auth.config.login_page, 200, @auth.config.agent
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it "should logout only if not logged in" do
|
|
33
|
+
@auth.should_receive(:authenticated?).once.and_return(false)
|
|
34
|
+
@auth.logout.should_not be_true
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it "should logout" do
|
|
38
|
+
@auth.config.should_receive(:save_topics).once
|
|
39
|
+
@auth.config.should_receive(:save_cookie_jar).once
|
|
40
|
+
@auth.instance_variable_set("@authenticated", true)
|
|
41
|
+
|
|
42
|
+
@auth.logout.should be_true
|
|
43
|
+
@auth.authenticated?.should_not be_true
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "should be logged_in? when wwf 8.0 displays the user name" do
|
|
47
|
+
lambda {
|
|
48
|
+
@auth.logged_in?(@logged_in_page).should be_true
|
|
49
|
+
}.should_not raise_error
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "should not be logged_in? when wwf 8.0 does not display the user name" do
|
|
53
|
+
lambda {
|
|
54
|
+
@auth.logged_in?(@not_logged_in_page).should_not be_true
|
|
55
|
+
}.should_not raise_error
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "should return a page from fetch_login_page" do
|
|
59
|
+
@auth.config.agent.should_receive(:get).with(@login_uri)
|
|
60
|
+
|
|
61
|
+
lambda {
|
|
62
|
+
@auth.fetch_login_page
|
|
63
|
+
}.should_not raise_error
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "should handle an error in fetch_login_page" do
|
|
67
|
+
@auth.config.agent.should_receive(:get).with(@login_uri).and_raise(StandardError)
|
|
68
|
+
|
|
69
|
+
lambda {
|
|
70
|
+
@auth.fetch_login_page
|
|
71
|
+
}.should raise_error( Impostor::LoginError )
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it "should return a login form from get_login_form" do
|
|
75
|
+
lambda {
|
|
76
|
+
@auth.get_login_form(@login_page).name.should == 'frmLogin'
|
|
77
|
+
}.should_not raise_error
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it "should raise login error when get_login_form receives a bad page" do
|
|
81
|
+
lambda {
|
|
82
|
+
@auth.get_login_form(@junk_page)
|
|
83
|
+
}.should raise_error( Impostor::LoginError )
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
it "should setup login form in set_username_and_password" do
|
|
87
|
+
form = mock "login form"
|
|
88
|
+
form.should_receive(:[]=).with("name", "tester")
|
|
89
|
+
form.should_receive(:[]=).with("password", "password")
|
|
90
|
+
lambda {
|
|
91
|
+
@auth.set_username_and_password(form).should == form
|
|
92
|
+
}.should_not raise_error
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
it "should return a logged in page when posting the login" do
|
|
96
|
+
form = @auth.get_login_form(@login_page)
|
|
97
|
+
@auth.config.agent.should_receive(:submit).with(instance_of(Mechanize::Form), nil, {}).and_return(@logged_in_page)
|
|
98
|
+
lambda {
|
|
99
|
+
@auth.post_login(form).should == @logged_in_page
|
|
100
|
+
}.should_not raise_error
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
it "should raise a login error when posting has an underlying exception" do
|
|
104
|
+
form = @login_page.form('frmLogin')
|
|
105
|
+
@auth.config.agent.should_receive(:submit).with(instance_of(Mechanize::Form), nil, {}).and_raise(StandardError)
|
|
106
|
+
lambda {
|
|
107
|
+
@auth.post_login(form)
|
|
108
|
+
}.should raise_error( Impostor::LoginError )
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it "should login" do
|
|
112
|
+
@auth.config.agent.should_receive(:get).with(@login_uri).and_return(@login_page)
|
|
113
|
+
@auth.config.agent.should_receive(:submit).with(instance_of(Mechanize::Form), nil, {}).and_return(@logged_in_page)
|
|
114
|
+
|
|
115
|
+
lambda {
|
|
116
|
+
@auth.login.should be_true
|
|
117
|
+
}.should_not raise_error
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
describe "posting routines" do
|
|
123
|
+
|
|
124
|
+
before do
|
|
125
|
+
@post = wwf80_post
|
|
126
|
+
|
|
127
|
+
@reply_uri = URI.parse("http://example.com/forum/new_reply_form.asp?TID=2")
|
|
128
|
+
|
|
129
|
+
@reply_page = load_fixture_page(
|
|
130
|
+
"wwf80-new_reply_form.html", @reply_uri, 200, @post.config.agent
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
@good_post_page = load_fixture_page(
|
|
134
|
+
"wwf80-post-reply-good-response.html",
|
|
135
|
+
@post.config.app_root, 200, @post.config.agent
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
@junk_page = load_fixture_page(
|
|
139
|
+
"junk.html", @reply_uri, 200, @post.config.agent
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
@error_page = load_fixture_page(
|
|
143
|
+
"wwf80-general-posting-error.html",
|
|
144
|
+
@post.config.app_root, 200, @post.config.agent
|
|
145
|
+
)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
it "should post a message in the topic of a forum" do
|
|
149
|
+
@post.auth.should_receive(:login_with_raises)
|
|
150
|
+
@post.config.agent.should_receive(:get).with(@reply_uri).and_return(@reply_page)
|
|
151
|
+
@post.config.agent.should_receive(:submit).with(instance_of(Mechanize::Form), nil, {}).and_return(@good_post_page)
|
|
152
|
+
|
|
153
|
+
lambda {
|
|
154
|
+
@post.post(formum=1, topic=2, message="Hello World").should == {
|
|
155
|
+
:forum => 1,
|
|
156
|
+
:topic => 2,
|
|
157
|
+
:post => 101899,
|
|
158
|
+
:message => "Hello World",
|
|
159
|
+
:result => true
|
|
160
|
+
}
|
|
161
|
+
}.should_not raise_error
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
it "should get a reply uri from get_reply_uri(forum, topic)" do
|
|
165
|
+
lambda {
|
|
166
|
+
@post.get_reply_uri(1,2).should == @reply_uri
|
|
167
|
+
}.should_not raise_error
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
it "should get_reply_page(uri)" do
|
|
171
|
+
@post.config.agent.should_receive(:get).with(@reply_uri).and_return(@reply_page)
|
|
172
|
+
lambda {
|
|
173
|
+
@post.get_reply_page(@reply_uri).should == @reply_page
|
|
174
|
+
}.should_not raise_error
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
it "should return reply from with get_post_form(page)" do
|
|
178
|
+
lambda {
|
|
179
|
+
@post.get_post_form(@reply_page).name.should == 'frmMessageForm'
|
|
180
|
+
}.should_not raise_error
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
it "should raise error when page to get_post_form(page) receives a bad page" do
|
|
184
|
+
lambda {
|
|
185
|
+
@post.get_post_form(@junk_page)
|
|
186
|
+
}.should raise_error( Impostor::PostError )
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
it "should set_message(form, message)" do
|
|
190
|
+
form = @post.get_post_form(@reply_page)
|
|
191
|
+
form.should_receive(:message=, "Hello World")
|
|
192
|
+
lambda {
|
|
193
|
+
@post.set_message(form, "Hello World")
|
|
194
|
+
}.should_not raise_error
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
it "should return response page from post_message(form)" do
|
|
198
|
+
form = mock "post form"
|
|
199
|
+
form.should_receive(:submit).and_return @reply_page
|
|
200
|
+
lambda {
|
|
201
|
+
@post.post_message(form).should == @reply_page
|
|
202
|
+
}.should_not raise_error
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
it "should raise post error when post_form fails" do
|
|
206
|
+
form = mock "post form"
|
|
207
|
+
form.should_receive(:submit).and_raise( Impostor::PostError )
|
|
208
|
+
lambda {
|
|
209
|
+
@post.post_message(form)
|
|
210
|
+
}.should raise_error( Impostor::PostError )
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
it "should not raise post error on valid reply get_post_from_result(page)" do
|
|
214
|
+
lambda {
|
|
215
|
+
@post.get_post_from_result(@good_post_page).should be_true
|
|
216
|
+
}.should_not raise_error
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
it "should raise post error on invalid reply get_post_from_result(page)" do
|
|
220
|
+
lambda {
|
|
221
|
+
@post.get_post_from_result(@error_page)
|
|
222
|
+
}.should raise_error( Impostor::PostError )
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
describe "topic routines" do
|
|
228
|
+
|
|
229
|
+
before do
|
|
230
|
+
@topic = wwf80_topic
|
|
231
|
+
|
|
232
|
+
@new_topic_uri = URI.parse("http://example.com/forum/new_topic_form.asp?FID=1")
|
|
233
|
+
@new_topic_page = load_fixture_page(
|
|
234
|
+
"wwf80-get-new_topic-form-good-response.html",
|
|
235
|
+
@new_topic_uri, 200, @topic.config.agent
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
@new_topic_response_page = load_fixture_page(
|
|
239
|
+
"wwf80-post-new_topic-good-response.html",
|
|
240
|
+
@topic.config.app_root, 200, @topic.config.agent
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
@error_page = load_fixture_page(
|
|
244
|
+
"wwf80-general-posting-error.html",
|
|
245
|
+
@topic.config.app_root, 200, @topic.config.agent
|
|
246
|
+
)
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
it "should return new topic uri when get_new_topic_uri called" do
|
|
250
|
+
lambda {
|
|
251
|
+
@topic.get_new_topic_uri(1, "OMG!", "Hello World").should == @new_topic_uri
|
|
252
|
+
}.should_not raise_error
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
it "should return new topic page when get_new_topic_page called" do
|
|
256
|
+
|
|
257
|
+
@topic.config.agent.should_receive(:get).with(@new_topic_uri).and_return(@new_topic_page)
|
|
258
|
+
|
|
259
|
+
lambda {
|
|
260
|
+
@topic.get_new_topic_page(@new_topic_uri)
|
|
261
|
+
}.should_not raise_error
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
it "should return new topic form when get_new_topic_form called" do
|
|
265
|
+
lambda {
|
|
266
|
+
@topic.get_new_topic_form(@new_topic_page).name.should == 'frmMessageForm'
|
|
267
|
+
}.should_not raise_error
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
it "should raise topic error when get_new_topic_form has error" do
|
|
271
|
+
@new_topic_page.should_receive(:form).with("frmMessageForm").and_return nil
|
|
272
|
+
lambda {
|
|
273
|
+
@topic.get_new_topic_form(@new_topic_page)
|
|
274
|
+
}.should raise_error( Impostor::TopicError )
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
it "should set subject and message on a form when set_subject_and_message called" do
|
|
278
|
+
form = mock "wwf80 topic form"
|
|
279
|
+
form.should_receive(:subject=).with("OMG!")
|
|
280
|
+
form.should_receive(:message=).with("Hello World")
|
|
281
|
+
lambda {
|
|
282
|
+
@topic.set_subject_and_message(form, "OMG!", "Hello World")
|
|
283
|
+
}.should_not raise_error
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
it "should post new topic with form when post_new_topic called" do
|
|
287
|
+
@topic.config.agent.should_receive(:submit).with(instance_of(Mechanize::Form), nil, {}).and_return(@new_topic_response_page)
|
|
288
|
+
new_topic_form = @topic.get_new_topic_form(@new_topic_page)
|
|
289
|
+
lambda {
|
|
290
|
+
@topic.post_new_topic(new_topic_form)
|
|
291
|
+
}.should_not raise_error
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
it "should raise topic error when posting_new_topic has an error" do
|
|
295
|
+
form = mock "a wwf80 form"
|
|
296
|
+
form.should_receive(:submit).and_raise(StandardError)
|
|
297
|
+
lambda {
|
|
298
|
+
@topic.post_new_topic(form)
|
|
299
|
+
}.should raise_error( Impostor::TopicError )
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
it "should not raise topic error on valid reply validate_new_topic_result(page)" do
|
|
303
|
+
lambda {
|
|
304
|
+
@topic.validate_new_topic_result(@new_topic_response_page).should be_true
|
|
305
|
+
}.should_not raise_error
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
it "should raise topic error on invalid reply validate_new_topic_result(page)" do
|
|
309
|
+
lambda {
|
|
310
|
+
@topic.validate_new_topic_result(@error_page)
|
|
311
|
+
}.should raise_error( Impostor::TopicError )
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
it "should return the created topic id from get_topic_from_result" do
|
|
315
|
+
lambda {
|
|
316
|
+
@topic.get_topic_from_result(@new_topic_response_page).should == 2
|
|
317
|
+
}.should_not raise_error
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
it "should create new topic" do
|
|
321
|
+
|
|
322
|
+
@topic.auth.should_receive(:login_with_raises)
|
|
323
|
+
@topic.config.agent.should_receive(:get).with(@new_topic_uri).and_return(@new_topic_page)
|
|
324
|
+
@topic.config.agent.should_receive(:submit).with(instance_of(Mechanize::Form), nil, {}).and_return(@new_topic_response_page)
|
|
325
|
+
@topic.config.should_receive(:add_subject).with(1, 2, "OMG!")
|
|
326
|
+
|
|
327
|
+
lambda {
|
|
328
|
+
@topic.new_topic(formum=1, subject="OMG!", message="Hello World").should == {
|
|
329
|
+
:forum => 1,
|
|
330
|
+
:topic => 2,
|
|
331
|
+
:subject => "OMG!",
|
|
332
|
+
:message => "Hello World",
|
|
333
|
+
:result => true
|
|
334
|
+
}
|
|
335
|
+
}.should_not raise_error
|
|
336
|
+
end
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: impostor
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
4
|
+
hash: 23
|
|
5
|
+
prerelease:
|
|
6
|
+
segments:
|
|
7
|
+
- 1
|
|
8
|
+
- 0
|
|
9
|
+
- 0
|
|
10
|
+
version: 1.0.0
|
|
5
11
|
platform: ruby
|
|
6
12
|
authors:
|
|
7
13
|
- Mike Mondragon
|
|
@@ -9,40 +15,68 @@ autorequire:
|
|
|
9
15
|
bindir: bin
|
|
10
16
|
cert_chain: []
|
|
11
17
|
|
|
12
|
-
date:
|
|
18
|
+
date: 2011-02-27 00:00:00 -08:00
|
|
13
19
|
default_executable:
|
|
14
20
|
dependencies:
|
|
15
21
|
- !ruby/object:Gem::Dependency
|
|
16
|
-
name:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
name: nokogiri
|
|
23
|
+
prerelease: false
|
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
20
26
|
requirements:
|
|
21
27
|
- - ">="
|
|
22
28
|
- !ruby/object:Gem::Version
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
hash: 15
|
|
30
|
+
segments:
|
|
31
|
+
- 1
|
|
32
|
+
- 4
|
|
33
|
+
- 4
|
|
34
|
+
version: 1.4.4
|
|
35
|
+
type: :runtime
|
|
36
|
+
version_requirements: *id001
|
|
25
37
|
- !ruby/object:Gem::Dependency
|
|
26
38
|
name: mechanize
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
39
|
+
prerelease: false
|
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
30
42
|
requirements:
|
|
31
43
|
- - ">="
|
|
32
44
|
- !ruby/object:Gem::Version
|
|
33
|
-
|
|
34
|
-
|
|
45
|
+
hash: 23
|
|
46
|
+
segments:
|
|
47
|
+
- 1
|
|
48
|
+
- 0
|
|
49
|
+
- 0
|
|
50
|
+
version: 1.0.0
|
|
51
|
+
type: :runtime
|
|
52
|
+
version_requirements: *id002
|
|
35
53
|
- !ruby/object:Gem::Dependency
|
|
36
54
|
name: hoe
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
55
|
+
prerelease: false
|
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
|
57
|
+
none: false
|
|
40
58
|
requirements:
|
|
41
59
|
- - ">="
|
|
42
60
|
- !ruby/object:Gem::Version
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
61
|
+
hash: 43
|
|
62
|
+
segments:
|
|
63
|
+
- 2
|
|
64
|
+
- 9
|
|
65
|
+
- 0
|
|
66
|
+
version: 2.9.0
|
|
67
|
+
type: :development
|
|
68
|
+
version_requirements: *id003
|
|
69
|
+
description: |-
|
|
70
|
+
imPOSTor posts messages to forums
|
|
71
|
+
|
|
72
|
+
== FEATURES/PROBLEMS:
|
|
73
|
+
|
|
74
|
+
Makes automated posts to the following forum applications:
|
|
75
|
+
|
|
76
|
+
* Web Wiz Forums (WWF) 7.9
|
|
77
|
+
* Web Wiz Forums (WWF) 8.0
|
|
78
|
+
* PHP Bullitin Board (phpBB) 2.2
|
|
79
|
+
* PHP Bullitin Board (phpBB) 3.0
|
|
46
80
|
email: mikemondragon@gmail.com
|
|
47
81
|
executables: []
|
|
48
82
|
|
|
@@ -54,6 +88,10 @@ extra_rdoc_files:
|
|
|
54
88
|
- README.txt
|
|
55
89
|
files:
|
|
56
90
|
- .gitignore
|
|
91
|
+
- .rspec
|
|
92
|
+
- .rvmrc
|
|
93
|
+
- Gemfile
|
|
94
|
+
- Gemfile.lock
|
|
57
95
|
- History.txt
|
|
58
96
|
- Manifest.txt
|
|
59
97
|
- README.txt
|
|
@@ -61,63 +99,94 @@ files:
|
|
|
61
99
|
- dev_tools/github.rb
|
|
62
100
|
- impostor.gemspec
|
|
63
101
|
- lib/impostor.rb
|
|
64
|
-
- lib/
|
|
65
|
-
- lib/
|
|
66
|
-
- lib/
|
|
67
|
-
- lib/
|
|
68
|
-
- lib/
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
-
|
|
102
|
+
- lib/impostor/auth.rb
|
|
103
|
+
- lib/impostor/config.rb
|
|
104
|
+
- lib/impostor/errors.rb
|
|
105
|
+
- lib/impostor/phpbb2.rb
|
|
106
|
+
- lib/impostor/phpbb3.rb
|
|
107
|
+
- lib/impostor/post.rb
|
|
108
|
+
- lib/impostor/topic.rb
|
|
109
|
+
- lib/impostor/wwf79.rb
|
|
110
|
+
- lib/impostor/wwf80.rb
|
|
111
|
+
- spec/auth_spec.rb
|
|
112
|
+
- spec/base_spec_helper.rb
|
|
113
|
+
- spec/caged_net_http.rb
|
|
114
|
+
- spec/config_spec.rb
|
|
115
|
+
- spec/fixtures/junk.html
|
|
116
|
+
- spec/fixtures/phpbb2-get-new_topic-form-good-response.html
|
|
117
|
+
- spec/fixtures/phpbb2-get-viewtopic-for-new-topic-good-response.html
|
|
118
|
+
- spec/fixtures/phpbb2-get-viewtopic-for-new-topic-malformed-response.html
|
|
119
|
+
- spec/fixtures/phpbb2-index.html
|
|
120
|
+
- spec/fixtures/phpbb2-logged-in.html
|
|
121
|
+
- spec/fixtures/phpbb2-login.html
|
|
122
|
+
- spec/fixtures/phpbb2-not-logged-in.html
|
|
123
|
+
- spec/fixtures/phpbb2-post-new_topic-good-response.html
|
|
124
|
+
- spec/fixtures/phpbb2-post-reply-good-response.html
|
|
125
|
+
- spec/fixtures/phpbb2-post-reply-throttled-response.html
|
|
126
|
+
- spec/fixtures/phpbb2-too-many-posts.html
|
|
127
|
+
- spec/fixtures/phpbb3-get-new-topic-form-good-response.html
|
|
128
|
+
- spec/fixtures/phpbb3-get-reply-form-good-response.html
|
|
129
|
+
- spec/fixtures/phpbb3-logged-in.html
|
|
130
|
+
- spec/fixtures/phpbb3-login.html
|
|
131
|
+
- spec/fixtures/phpbb3-not-logged-in.html
|
|
132
|
+
- spec/fixtures/phpbb3-post-new_topic-good-response.html
|
|
133
|
+
- spec/fixtures/phpbb3-post-reply-good-response.html
|
|
134
|
+
- spec/fixtures/vcr_cassettes/phpbb2-should-be-overlimit-creating-topic.yml
|
|
135
|
+
- spec/fixtures/vcr_cassettes/phpbb2-should-create-topic.yml
|
|
136
|
+
- spec/fixtures/vcr_cassettes/phpbb2-should-login.yml
|
|
137
|
+
- spec/fixtures/vcr_cassettes/phpbb2-should-not-create-new-topic.yml
|
|
138
|
+
- spec/fixtures/vcr_cassettes/phpbb2-should-not-login.yml
|
|
139
|
+
- spec/fixtures/vcr_cassettes/phpbb2-should-not-post.yml
|
|
140
|
+
- spec/fixtures/vcr_cassettes/phpbb2-should-overlimit-error-post.yml
|
|
141
|
+
- spec/fixtures/vcr_cassettes/phpbb2-should-post.yml
|
|
142
|
+
- spec/fixtures/vcr_cassettes/phpbb3-should-be-overlimit-creating-topic.yml
|
|
143
|
+
- spec/fixtures/vcr_cassettes/phpbb3-should-create-topic.yml
|
|
144
|
+
- spec/fixtures/vcr_cassettes/phpbb3-should-login.yml
|
|
145
|
+
- spec/fixtures/vcr_cassettes/phpbb3-should-not-create-new-topic.yml
|
|
146
|
+
- spec/fixtures/vcr_cassettes/phpbb3-should-not-login.yml
|
|
147
|
+
- spec/fixtures/vcr_cassettes/phpbb3-should-not-post.yml
|
|
148
|
+
- spec/fixtures/vcr_cassettes/phpbb3-should-overlimit-error-post.yml
|
|
149
|
+
- spec/fixtures/vcr_cassettes/phpbb3-should-post.yml
|
|
150
|
+
- spec/fixtures/wwf79-forum_posts.html
|
|
151
|
+
- spec/fixtures/wwf79-general-new-topic-error.html
|
|
152
|
+
- spec/fixtures/wwf79-general-posting-error.html
|
|
153
|
+
- spec/fixtures/wwf79-good-post-forum_posts.html
|
|
154
|
+
- spec/fixtures/wwf79-index.html
|
|
155
|
+
- spec/fixtures/wwf79-logged-in.html
|
|
156
|
+
- spec/fixtures/wwf79-login.html
|
|
157
|
+
- spec/fixtures/wwf79-new-topic-forum_posts-response.html
|
|
158
|
+
- spec/fixtures/wwf79-new-topic-post_message_form.html
|
|
159
|
+
- spec/fixtures/wwf79-not-logged-in.html
|
|
160
|
+
- spec/fixtures/wwf79-too-many-posts.html
|
|
161
|
+
- spec/fixtures/wwf79-too-many-topics.html
|
|
162
|
+
- spec/fixtures/wwf80-general-posting-error.html
|
|
163
|
+
- spec/fixtures/wwf80-get-new_topic-form-good-response.html
|
|
164
|
+
- spec/fixtures/wwf80-get-viewtopic-for-new-topic-good-response.html
|
|
165
|
+
- spec/fixtures/wwf80-index.html
|
|
166
|
+
- spec/fixtures/wwf80-logged-in.html
|
|
167
|
+
- spec/fixtures/wwf80-login.html
|
|
168
|
+
- spec/fixtures/wwf80-new_reply_form.html
|
|
169
|
+
- spec/fixtures/wwf80-not-logged-in.html
|
|
170
|
+
- spec/fixtures/wwf80-post-new_topic-good-response.html
|
|
171
|
+
- spec/fixtures/wwf80-post-reply-good-response.html
|
|
172
|
+
- spec/fixtures/wwf80-too-many-posts.html
|
|
173
|
+
- spec/impostor_spec_helper.rb
|
|
174
|
+
- spec/integration/phpbb2_spec.rb
|
|
175
|
+
- spec/integration/phpbb3_spec.rb
|
|
176
|
+
- spec/integration_spec_helper.rb
|
|
177
|
+
- spec/phpbb2_spec.rb
|
|
178
|
+
- spec/phpbb3_spec.rb
|
|
179
|
+
- spec/post_spec.rb
|
|
180
|
+
- spec/spec_helper.rb
|
|
181
|
+
- spec/test_impostor.rb
|
|
182
|
+
- spec/topic_spec.rb
|
|
183
|
+
- spec/wwf79_spec.rb
|
|
184
|
+
- spec/wwf80_spec.rb
|
|
185
|
+
- .gemtest
|
|
119
186
|
has_rdoc: true
|
|
120
|
-
homepage:
|
|
187
|
+
homepage: https://github.com/monde/impostor
|
|
188
|
+
licenses: []
|
|
189
|
+
|
|
121
190
|
post_install_message:
|
|
122
191
|
rdoc_options:
|
|
123
192
|
- --main
|
|
@@ -125,29 +194,29 @@ rdoc_options:
|
|
|
125
194
|
require_paths:
|
|
126
195
|
- lib
|
|
127
196
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
197
|
+
none: false
|
|
128
198
|
requirements:
|
|
129
199
|
- - ">="
|
|
130
200
|
- !ruby/object:Gem::Version
|
|
201
|
+
hash: 3
|
|
202
|
+
segments:
|
|
203
|
+
- 0
|
|
131
204
|
version: "0"
|
|
132
|
-
version:
|
|
133
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
|
+
none: false
|
|
134
207
|
requirements:
|
|
135
208
|
- - ">="
|
|
136
209
|
- !ruby/object:Gem::Version
|
|
210
|
+
hash: 3
|
|
211
|
+
segments:
|
|
212
|
+
- 0
|
|
137
213
|
version: "0"
|
|
138
|
-
version:
|
|
139
214
|
requirements: []
|
|
140
215
|
|
|
141
216
|
rubyforge_project: impostor
|
|
142
|
-
rubygems_version: 1.
|
|
217
|
+
rubygems_version: 1.5.0
|
|
143
218
|
signing_key:
|
|
144
|
-
specification_version:
|
|
219
|
+
specification_version: 3
|
|
145
220
|
summary: imPOSTor posts messages to non-RESTful forums and blogs
|
|
146
|
-
test_files:
|
|
147
|
-
|
|
148
|
-
- test/test_www_impostor_phpbb3.rb
|
|
149
|
-
- test/test_www_impostor_wwf79.rb
|
|
150
|
-
- test/test_www_impostor_wwf80.rb
|
|
151
|
-
- test/test_github.rb
|
|
152
|
-
- test/test_helper.rb
|
|
153
|
-
- test/test_www_impostor.rb
|
|
221
|
+
test_files: []
|
|
222
|
+
|