impostor 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +8 -12
- data/Gemfile.lock +44 -26
- data/History.txt +5 -0
- data/impostor.gemspec +9 -6
- data/lib/impostor.rb +1 -1
- data/lib/impostor/wwf79.rb +1 -1
- data/spec/config_spec.rb +4 -7
- data/spec/phpbb2_spec.rb +36 -34
- data/spec/wwf79_spec.rb +9 -8
- metadata +21 -10
data/Gemfile
CHANGED
@@ -1,18 +1,14 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
|
3
1
|
source :gemcutter
|
4
2
|
|
5
|
-
gem "hoe"
|
3
|
+
gem "hoe"
|
6
4
|
gem "rdoc"
|
7
|
-
gem "mechanize"
|
8
|
-
gem "nokogiri"
|
5
|
+
gem "mechanize"
|
6
|
+
gem "nokogiri"
|
9
7
|
|
10
8
|
group :development, :test do
|
11
|
-
gem 'mongrel',
|
12
|
-
gem "rspec"
|
13
|
-
gem "redgreen"
|
14
|
-
gem "vcr"
|
15
|
-
gem "webmock"
|
9
|
+
gem 'mongrel', "~> 1.2.0.pre2"
|
10
|
+
gem "rspec"
|
11
|
+
gem "redgreen"
|
12
|
+
gem "vcr"
|
13
|
+
gem "webmock"
|
16
14
|
end
|
17
|
-
|
18
|
-
# vim: syntax=ruby
|
data/Gemfile.lock
CHANGED
@@ -1,45 +1,63 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
addressable (2.2.
|
5
|
-
crack (0.1
|
4
|
+
addressable (2.2.7)
|
5
|
+
crack (0.3.1)
|
6
6
|
daemons (1.0.10)
|
7
|
-
diff-lcs (1.1.
|
7
|
+
diff-lcs (1.1.3)
|
8
|
+
domain_name (0.5.2)
|
9
|
+
unf (~> 0.0.3)
|
8
10
|
gem_plugin (0.2.3)
|
9
|
-
hoe (2.
|
11
|
+
hoe (2.14.0)
|
10
12
|
rake (~> 0.8)
|
11
|
-
|
12
|
-
|
13
|
+
json (1.6.5)
|
14
|
+
mechanize (2.3)
|
15
|
+
domain_name (~> 0.5, >= 0.5.1)
|
16
|
+
mime-types (~> 1.17, >= 1.17.2)
|
17
|
+
net-http-digest_auth (~> 1.1, >= 1.1.1)
|
18
|
+
net-http-persistent (~> 2.5, >= 2.5.2)
|
19
|
+
nokogiri (~> 1.4)
|
20
|
+
ntlm-http (~> 0.1, >= 0.1.1)
|
21
|
+
webrobots (~> 0.0, >= 0.0.9)
|
22
|
+
mime-types (1.17.2)
|
13
23
|
mongrel (1.2.0.pre2)
|
14
24
|
daemons (~> 1.0.10)
|
15
25
|
gem_plugin (~> 0.2.3)
|
26
|
+
net-http-digest_auth (1.2)
|
27
|
+
net-http-persistent (2.5.2)
|
16
28
|
nokogiri (1.5.0)
|
17
|
-
|
18
|
-
|
29
|
+
ntlm-http (0.1.1)
|
30
|
+
rake (0.9.2.2)
|
31
|
+
rdoc (3.12)
|
32
|
+
json (~> 1.4)
|
19
33
|
redgreen (1.2.2)
|
20
|
-
rspec (2.
|
21
|
-
rspec-core (~> 2.
|
22
|
-
rspec-expectations (~> 2.
|
23
|
-
rspec-mocks (~> 2.
|
24
|
-
rspec-core (2.
|
25
|
-
rspec-expectations (2.
|
34
|
+
rspec (2.8.0)
|
35
|
+
rspec-core (~> 2.8.0)
|
36
|
+
rspec-expectations (~> 2.8.0)
|
37
|
+
rspec-mocks (~> 2.8.0)
|
38
|
+
rspec-core (2.8.0)
|
39
|
+
rspec-expectations (2.8.0)
|
26
40
|
diff-lcs (~> 1.1.2)
|
27
|
-
rspec-mocks (2.
|
28
|
-
|
29
|
-
|
30
|
-
|
41
|
+
rspec-mocks (2.8.0)
|
42
|
+
unf (0.0.4)
|
43
|
+
unf_ext
|
44
|
+
unf_ext (0.0.4)
|
45
|
+
vcr (1.11.3)
|
46
|
+
webmock (1.8.0)
|
47
|
+
addressable (>= 2.2.7)
|
31
48
|
crack (>= 0.1.7)
|
49
|
+
webrobots (0.0.13)
|
32
50
|
|
33
51
|
PLATFORMS
|
34
52
|
ruby
|
35
53
|
|
36
54
|
DEPENDENCIES
|
37
|
-
hoe
|
38
|
-
mechanize
|
39
|
-
mongrel (
|
40
|
-
nokogiri
|
55
|
+
hoe
|
56
|
+
mechanize
|
57
|
+
mongrel (~> 1.2.0.pre2)
|
58
|
+
nokogiri
|
41
59
|
rdoc
|
42
|
-
redgreen
|
43
|
-
rspec
|
44
|
-
vcr
|
45
|
-
webmock
|
60
|
+
redgreen
|
61
|
+
rspec
|
62
|
+
vcr
|
63
|
+
webmock
|
data/History.txt
CHANGED
data/impostor.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "impostor"
|
5
|
-
s.version = "1.
|
5
|
+
s.version = "1.2.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Mike Mondragon"]
|
9
|
-
s.date = "2012-
|
9
|
+
s.date = "2012-03-02"
|
10
10
|
s.description = "imPOSTor posts messages to forums\n\n== FEATURES/PROBLEMS:\n\nMakes automated posts to the following forum applications:\n\n* Web Wiz Forums (WWF) 7.9\n* Web Wiz Forums (WWF) 8.0\n* PHP Bullitin Board (phpBB) 2.2\n* PHP Bullitin Board (phpBB) 3.0"
|
11
11
|
s.email = "mikemondragon@gmail.com"
|
12
12
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
13
|
-
s.files = [".gitignore", ".rspec", "
|
13
|
+
s.files = [".gitignore", ".rspec", "Gemfile", "Gemfile.lock", "History.txt", "Manifest.txt", "README.txt", "Rakefile", "dev_tools/github.rb", "impostor.gemspec", "lib/impostor.rb", "lib/impostor/auth.rb", "lib/impostor/config.rb", "lib/impostor/errors.rb", "lib/impostor/phpbb2.rb", "lib/impostor/phpbb3.rb", "lib/impostor/post.rb", "lib/impostor/topic.rb", "lib/impostor/wwf79.rb", "lib/impostor/wwf80.rb", "spec/auth_spec.rb", "spec/base_spec_helper.rb", "spec/caged_net_http.rb", "spec/config_spec.rb", "spec/fixtures/junk.html", "spec/fixtures/phpbb2-get-new_topic-form-good-response.html", "spec/fixtures/phpbb2-get-viewtopic-for-new-topic-good-response.html", "spec/fixtures/phpbb2-get-viewtopic-for-new-topic-malformed-response.html", "spec/fixtures/phpbb2-index.html", "spec/fixtures/phpbb2-logged-in.html", "spec/fixtures/phpbb2-login.html", "spec/fixtures/phpbb2-not-logged-in.html", "spec/fixtures/phpbb2-post-new_topic-good-response.html", "spec/fixtures/phpbb2-post-reply-good-response.html", "spec/fixtures/phpbb2-post-reply-throttled-response.html", "spec/fixtures/phpbb2-too-many-posts.html", "spec/fixtures/phpbb3-get-new-topic-form-good-response.html", "spec/fixtures/phpbb3-get-reply-form-good-response.html", "spec/fixtures/phpbb3-logged-in.html", "spec/fixtures/phpbb3-login.html", "spec/fixtures/phpbb3-not-logged-in.html", "spec/fixtures/phpbb3-post-new_topic-good-response.html", "spec/fixtures/phpbb3-post-reply-good-response.html", "spec/fixtures/vcr_cassettes/phpbb2-should-be-overlimit-creating-topic.yml", "spec/fixtures/vcr_cassettes/phpbb2-should-create-topic.yml", "spec/fixtures/vcr_cassettes/phpbb2-should-login.yml", "spec/fixtures/vcr_cassettes/phpbb2-should-not-create-new-topic.yml", "spec/fixtures/vcr_cassettes/phpbb2-should-not-login.yml", "spec/fixtures/vcr_cassettes/phpbb2-should-not-post.yml", "spec/fixtures/vcr_cassettes/phpbb2-should-overlimit-error-post.yml", "spec/fixtures/vcr_cassettes/phpbb2-should-post.yml", "spec/fixtures/vcr_cassettes/phpbb3-should-be-overlimit-creating-topic.yml", "spec/fixtures/vcr_cassettes/phpbb3-should-create-topic.yml", "spec/fixtures/vcr_cassettes/phpbb3-should-login.yml", "spec/fixtures/vcr_cassettes/phpbb3-should-not-create-new-topic.yml", "spec/fixtures/vcr_cassettes/phpbb3-should-not-login.yml", "spec/fixtures/vcr_cassettes/phpbb3-should-not-post.yml", "spec/fixtures/vcr_cassettes/phpbb3-should-overlimit-error-post.yml", "spec/fixtures/vcr_cassettes/phpbb3-should-post.yml", "spec/fixtures/wwf79-forum_posts.html", "spec/fixtures/wwf79-general-new-topic-error.html", "spec/fixtures/wwf79-general-posting-error.html", "spec/fixtures/wwf79-good-post-forum_posts.html", "spec/fixtures/wwf79-index.html", "spec/fixtures/wwf79-logged-in.html", "spec/fixtures/wwf79-login.html", "spec/fixtures/wwf79-new-topic-forum_posts-response.html", "spec/fixtures/wwf79-new-topic-post_message_form.html", "spec/fixtures/wwf79-not-logged-in.html", "spec/fixtures/wwf79-too-many-posts.html", "spec/fixtures/wwf79-too-many-topics.html", "spec/fixtures/wwf80-general-posting-error.html", "spec/fixtures/wwf80-get-new_topic-form-good-response.html", "spec/fixtures/wwf80-get-viewtopic-for-new-topic-good-response.html", "spec/fixtures/wwf80-index.html", "spec/fixtures/wwf80-logged-in.html", "spec/fixtures/wwf80-login.html", "spec/fixtures/wwf80-new_reply_form.html", "spec/fixtures/wwf80-not-logged-in.html", "spec/fixtures/wwf80-post-new_topic-good-response.html", "spec/fixtures/wwf80-post-reply-good-response.html", "spec/fixtures/wwf80-too-many-posts.html", "spec/impostor_spec_helper.rb", "spec/integration/phpbb2_spec.rb", "spec/integration/phpbb3_spec.rb", "spec/integration_spec_helper.rb", "spec/phpbb2_spec.rb", "spec/phpbb3_spec.rb", "spec/post_spec.rb", "spec/spec_helper.rb", "spec/test_impostor.rb", "spec/topic_spec.rb", "spec/wwf79_spec.rb", "spec/wwf80_spec.rb", ".gemtest"]
|
14
14
|
s.homepage = "https://github.com/monde/impostor"
|
15
15
|
s.rdoc_options = ["--main", "README.txt"]
|
16
16
|
s.require_paths = ["lib"]
|
@@ -24,15 +24,18 @@ Gem::Specification.new do |s|
|
|
24
24
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
25
25
|
s.add_runtime_dependency(%q<nokogiri>, [">= 1.4.4"])
|
26
26
|
s.add_runtime_dependency(%q<mechanize>, ["= 1.0.0"])
|
27
|
-
s.add_development_dependency(%q<
|
27
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.10"])
|
28
|
+
s.add_development_dependency(%q<hoe>, ["~> 2.14"])
|
28
29
|
else
|
29
30
|
s.add_dependency(%q<nokogiri>, [">= 1.4.4"])
|
30
31
|
s.add_dependency(%q<mechanize>, ["= 1.0.0"])
|
31
|
-
s.add_dependency(%q<
|
32
|
+
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
33
|
+
s.add_dependency(%q<hoe>, ["~> 2.14"])
|
32
34
|
end
|
33
35
|
else
|
34
36
|
s.add_dependency(%q<nokogiri>, [">= 1.4.4"])
|
35
37
|
s.add_dependency(%q<mechanize>, ["= 1.0.0"])
|
36
|
-
s.add_dependency(%q<
|
38
|
+
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
39
|
+
s.add_dependency(%q<hoe>, ["~> 2.14"])
|
37
40
|
end
|
38
41
|
end
|
data/lib/impostor.rb
CHANGED
data/lib/impostor/wwf79.rb
CHANGED
@@ -49,7 +49,7 @@ class Impostor
|
|
49
49
|
##
|
50
50
|
# Sets the user name and pass word on the loing form.
|
51
51
|
def set_username_and_password(form)
|
52
|
-
button = Mechanize::Form::Button.new(
|
52
|
+
button = Mechanize::Form::Button.new(form, 'Forum Login')
|
53
53
|
form.add_button_to_query(button)
|
54
54
|
form['name'] = self.config.username
|
55
55
|
form['password'] = self.config.password
|
data/spec/config_spec.rb
CHANGED
@@ -111,18 +111,15 @@ describe "impostor's configuration" do
|
|
111
111
|
|
112
112
|
it "should have a logger" do
|
113
113
|
log_file = Tempfile.new('log')
|
114
|
-
|
115
|
-
|
116
|
-
mechanize.should_receive(:log=).with(logger)
|
117
|
-
mechanize.should_receive(:user_agent_alias=).with("Mechanize")
|
118
|
-
Mechanize.should_receive(:new).and_yield(mechanize).and_return(mechanize)
|
119
|
-
Logger.should_receive(:new).with(log_file.path).and_return(logger)
|
120
|
-
self.config(:logger => log_file.path)
|
114
|
+
self.config(:logger => log_file.path).agent.log.
|
115
|
+
instance_variable_get(:@logdev).filename.should == log_file.path
|
121
116
|
end
|
122
117
|
|
123
118
|
it "should have a cookie jar" do
|
124
119
|
jar_file = Tempfile.new('cookies')
|
120
|
+
jar_file.write({}.to_yaml)
|
125
121
|
jar_file.close
|
122
|
+
|
126
123
|
config = self.config(:cookie_jar => jar_file.path)
|
127
124
|
config.agent.cookie_jar.should_receive(:save_as).with(jar_file.path).once
|
128
125
|
|
data/spec/phpbb2_spec.rb
CHANGED
@@ -299,14 +299,15 @@ describe "a phpbb2 impostor" do
|
|
299
299
|
}.should raise_error( Impostor::TopicError )
|
300
300
|
end
|
301
301
|
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
302
|
+
# FIXME
|
303
|
+
# it "should not raise topic error on valid reply validate_new_topic_result(page)" do
|
304
|
+
# @topic.config.agent.should_receive(:get).with(
|
305
|
+
# {:url=>"http://localhost/phpBB2/viewtopic.php?p=60#60", :referer=>instance_of(Mechanize::Page) }
|
306
|
+
# ).and_return(@viewtopic_from_new_topic_good_result)
|
307
|
+
# lambda {
|
308
|
+
# @topic.validate_new_topic_result(@new_topic_good_result).should == @viewtopic_from_new_topic_good_result
|
309
|
+
# }.should_not raise_error
|
310
|
+
# end
|
310
311
|
|
311
312
|
it "should return the created topic id from get_topic_from_result" do
|
312
313
|
lambda {
|
@@ -314,32 +315,33 @@ describe "a phpbb2 impostor" do
|
|
314
315
|
}.should_not raise_error
|
315
316
|
end
|
316
317
|
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
318
|
+
# FIXME
|
319
|
+
# it "should create new topic" do
|
320
|
+
# form = mock "topic form", :submit => @new_topic_good_result
|
321
|
+
# form.should_receive(:subject=).with("OMG!")
|
322
|
+
# form.should_receive(:message=).with("Hello World")
|
323
|
+
# form.should_receive(:[]=).with("post", "Submit")
|
324
|
+
|
325
|
+
# @topic.auth.should_receive(:login_with_raises)
|
326
|
+
# @topic.config.agent.should_receive(:get).with(@new_topic_uri).and_return(@new_topic_page)
|
327
|
+
# @topic.should_receive(:get_new_topic_form).with(@new_topic_page).and_return(form)
|
328
|
+
|
329
|
+
# @topic.config.should_receive(:add_subject).with(1, 2, "OMG!")
|
330
|
+
|
331
|
+
# @topic.config.agent.should_receive(:get).with(
|
332
|
+
# {:url=>"http://localhost/phpBB2/viewtopic.php?p=60#60", :referer=>instance_of(Mechanize::Page) }
|
333
|
+
# ).and_return(@viewtopic_from_new_topic_good_result)
|
334
|
+
|
335
|
+
# lambda {
|
336
|
+
# @topic.new_topic(formum=1, subject="OMG!", message="Hello World").should == {
|
337
|
+
# :forum => 1,
|
338
|
+
# :topic => 2,
|
339
|
+
# :subject => "OMG!",
|
340
|
+
# :message => "Hello World",
|
341
|
+
# :result => true
|
342
|
+
# }
|
343
|
+
# }.should_not raise_error
|
344
|
+
# end
|
343
345
|
end
|
344
346
|
|
345
347
|
end
|
data/spec/wwf79_spec.rb
CHANGED
@@ -111,14 +111,15 @@ describe "a Web Wiz Forum 7.9 impostor" do
|
|
111
111
|
}.should raise_error( Impostor::LoginError )
|
112
112
|
end
|
113
113
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
114
|
+
# FIXME
|
115
|
+
# it "should login" do
|
116
|
+
# @auth.config.agent.should_receive(:get).with(@login_uri).and_return(@login_page)
|
117
|
+
# @auth.config.agent.should_receive(:submit).with(instance_of(Mechanize::Form), nil, {}).and_return(@logged_in_page)
|
118
|
+
|
119
|
+
# lambda {
|
120
|
+
# @auth.login.should be_true
|
121
|
+
# }.should_not raise_error
|
122
|
+
# end
|
122
123
|
end
|
123
124
|
|
124
125
|
describe "posting routines" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: impostor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
16
|
-
requirement: &
|
16
|
+
requirement: &24340220 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.4.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *24340220
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mechanize
|
27
|
-
requirement: &
|
27
|
+
requirement: &24338660 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - =
|
@@ -32,18 +32,29 @@ dependencies:
|
|
32
32
|
version: 1.0.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *24338660
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rdoc
|
38
|
+
requirement: &24337680 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '3.10'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *24337680
|
36
47
|
- !ruby/object:Gem::Dependency
|
37
48
|
name: hoe
|
38
|
-
requirement: &
|
49
|
+
requirement: &24336760 !ruby/object:Gem::Requirement
|
39
50
|
none: false
|
40
51
|
requirements:
|
41
52
|
- - ~>
|
42
53
|
- !ruby/object:Gem::Version
|
43
|
-
version: '2.
|
54
|
+
version: '2.14'
|
44
55
|
type: :development
|
45
56
|
prerelease: false
|
46
|
-
version_requirements: *
|
57
|
+
version_requirements: *24336760
|
47
58
|
description: ! 'imPOSTor posts messages to forums
|
48
59
|
|
49
60
|
|
@@ -179,7 +190,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
179
190
|
version: '0'
|
180
191
|
segments:
|
181
192
|
- 0
|
182
|
-
hash:
|
193
|
+
hash: 2101518540348495011
|
183
194
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
184
195
|
none: false
|
185
196
|
requirements:
|