sem4r 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +22 -0
- data/README.rdoc +74 -0
- data/Rakefile +126 -0
- data/VERSION.yml +5 -0
- data/bin/sem +34 -0
- data/config/sem4r.example.yml +51 -0
- data/examples_blog/2009-11-29-hello-world.rb +12 -0
- data/examples_blog/2009-12-12-create-campaign.rb +29 -0
- data/examples_blog/2010-02-06-constants-scope.rb +8 -0
- data/examples_blog/2010-02-07-ad-parameters.rb +47 -0
- data/examples_sem4r/01_get_account.rb +37 -0
- data/examples_sem4r/02_get_info.rb +32 -0
- data/examples_sem4r/03_list_ad.rb +47 -0
- data/examples_sem4r/04_list_keywords.rb +54 -0
- data/examples_sem4r/05_request_report.rb +51 -0
- data/examples_sem4r/05_request_report_2010.rb +40 -0
- data/examples_sem4r/06_create_campaigns.rb +86 -0
- data/examples_sem4r/07_create_campaigns_block.rb +99 -0
- data/examples_sem4r/07_create_campaigns_simple.rb +65 -0
- data/examples_sem4r/08_ad_params.rb +70 -0
- data/examples_sem4r/09_targeting_idea.rb +59 -0
- data/examples_sem4r/10_get_location.rb +28 -0
- data/examples_sem4r/11_submit_bulk_job.rb +82 -0
- data/examples_sem4r/12_list_bulk_job.rb +29 -0
- data/examples_sem4r/30_prune_empty_adgroup.rb +50 -0
- data/examples_sem4r/31_empty_accounts.rb +40 -0
- data/examples_sem4r/example_helper.rb +115 -0
- data/lib/sem4r/account.rb +349 -0
- data/lib/sem4r/ad_extension_override/ad_extension_override_service.rb +30 -0
- data/lib/sem4r/ad_group/ad_group.rb +340 -0
- data/lib/sem4r/ad_group/ad_group_bids.rb +170 -0
- data/lib/sem4r/ad_group/ad_group_service.rb +75 -0
- data/lib/sem4r/ad_group/mobile_ad_image.rb +33 -0
- data/lib/sem4r/ad_group_ad/ad_group_ad.rb +98 -0
- data/lib/sem4r/ad_group_ad/ad_group_ad_operations.rb +38 -0
- data/lib/sem4r/ad_group_ad/ad_group_ad_service.rb +56 -0
- data/lib/sem4r/ad_group_ad/ad_group_mobile_ad.rb +137 -0
- data/lib/sem4r/ad_group_ad/ad_group_text_ad.rb +98 -0
- data/lib/sem4r/ad_group_criterion/ad_group_criterion.rb +144 -0
- data/lib/sem4r/ad_group_criterion/ad_group_criterion_bids.rb +115 -0
- data/lib/sem4r/ad_group_criterion/ad_group_criterion_operations.rb +35 -0
- data/lib/sem4r/ad_group_criterion/ad_group_criterion_service.rb +58 -0
- data/lib/sem4r/ad_group_criterion/criterion.rb +67 -0
- data/lib/sem4r/ad_group_criterion/criterion_keyword.rb +80 -0
- data/lib/sem4r/ad_group_criterion/criterion_placement.rb +66 -0
- data/lib/sem4r/ad_param/ad_param.rb +96 -0
- data/lib/sem4r/ad_param/ad_param_operation.rb +34 -0
- data/lib/sem4r/ad_param/ad_param_service.rb +59 -0
- data/lib/sem4r/adwords.rb +242 -0
- data/lib/sem4r/api_counters.rb +7 -0
- data/lib/sem4r/base.rb +43 -0
- data/lib/sem4r/bulk_mutate_job/bulk_mutate_job.rb +108 -0
- data/lib/sem4r/bulk_mutate_job/bulk_mutate_job_selector.rb +56 -0
- data/lib/sem4r/bulk_mutate_job/bulk_mutate_job_service.rb +57 -0
- data/lib/sem4r/bulk_mutate_job/job_operations.rb +35 -0
- data/lib/sem4r/campaign/campaign.rb +193 -0
- data/lib/sem4r/campaign/campaign_service.rb +91 -0
- data/lib/sem4r/campaign_criterion/campaign_criterion_service.rb +30 -0
- data/lib/sem4r/campaign_target/campaign_target_service.rb +30 -0
- data/lib/sem4r/cli/cli_command.rb +101 -0
- data/lib/sem4r/cli/cli_commands.rb +60 -0
- data/lib/sem4r/cli/cli_common_args.rb +293 -0
- data/lib/sem4r/cli/cli_download_report.rb +81 -0
- data/lib/sem4r/cli/cli_helpers.rb +57 -0
- data/lib/sem4r/cli/cli_ideas.rb +100 -0
- data/lib/sem4r/cli/cli_list_ads.rb +74 -0
- data/lib/sem4r/cli/cli_list_keywords.rb +76 -0
- data/lib/sem4r/cli/cli_request_report.rb +104 -0
- data/lib/sem4r/cli/cli_sem.rb +64 -0
- data/lib/sem4r/common/operation.rb +78 -0
- data/lib/sem4r/credentials.rb +86 -0
- data/lib/sem4r/extensions.rb +62 -0
- data/lib/sem4r/geo_location/geo_location_service.rb +59 -0
- data/lib/sem4r/info/info_service.rb +115 -0
- data/lib/sem4r/report_definition/report_definition.rb +104 -0
- data/lib/sem4r/report_definition/report_definition_operation.rb +34 -0
- data/lib/sem4r/report_definition/report_definition_selector.rb +31 -0
- data/lib/sem4r/report_definition/report_definition_service.rb +55 -0
- data/lib/sem4r/sem4r_error.rb +28 -0
- data/lib/sem4r/services/service.rb +74 -0
- data/lib/sem4r/services/soap_call.rb +100 -0
- data/lib/sem4r/services/soap_connector.rb +284 -0
- data/lib/sem4r/services/soap_error.rb +38 -0
- data/lib/sem4r/services/soap_message_v13.rb +129 -0
- data/lib/sem4r/services/soap_message_v2009.rb +170 -0
- data/lib/sem4r/soap_attributes.rb +141 -0
- data/lib/sem4r/targeting_idea/targeting_idea.rb +158 -0
- data/lib/sem4r/targeting_idea/targeting_idea_selector.rb +200 -0
- data/lib/sem4r/targeting_idea/targeting_idea_service.rb +51 -0
- data/lib/sem4r/v13_account/account_service.rb +54 -0
- data/lib/sem4r/v13_account/billing_address.rb +67 -0
- data/lib/sem4r/v13_report/report.rb +185 -0
- data/lib/sem4r/v13_report/report_job.rb +51 -0
- data/lib/sem4r/v13_report/report_service.rb +89 -0
- data/lib/sem4r/v13_traffic_estimator/traffic_estimator_service.rb +30 -0
- data/lib/sem4r.rb +142 -0
- data/lib/sem4r_cli.rb +40 -0
- data/sem4r.gemspec +247 -0
- data/spec/aggregates_spec_helper.rb +59 -0
- data/spec/fixtures/sem4r.example.yml +26 -0
- data/spec/fixtures/services/ad_group/get-first-req.xml +28 -0
- data/spec/fixtures/services/ad_group/get-first-res.xml +91 -0
- data/spec/fixtures/services/ad_group/get-manual-cpm-bids-req.xml +106 -0
- data/spec/fixtures/services/ad_group/get-manual-cpm-bids-res.xml +75 -0
- data/spec/fixtures/services/ad_group/mutate_add-req.xml +52 -0
- data/spec/fixtures/services/ad_group/mutate_add-res.xml +33 -0
- data/spec/fixtures/services/ad_group_ad/get_mobile_ad-req.xml +28 -0
- data/spec/fixtures/services/ad_group_ad/get_mobile_ad-res.xml +194 -0
- data/spec/fixtures/services/ad_group_ad/get_text_ad-req.xml +29 -0
- data/spec/fixtures/services/ad_group_ad/get_text_ad-res.xml +55 -0
- data/spec/fixtures/services/ad_group_ad/mutate_add_mobile_ad-req.xml +50 -0
- data/spec/fixtures/services/ad_group_ad/mutate_add_mobile_ad-res.xml +42 -0
- data/spec/fixtures/services/ad_group_ad/mutate_add_text_ad-req.xml +37 -0
- data/spec/fixtures/services/ad_group_ad/mutate_add_text_ad-res.xml +32 -0
- data/spec/fixtures/services/ad_group_ad/mutate_add_two_criterions-req.xml +83 -0
- data/spec/fixtures/services/ad_group_ad/mutate_add_two_criterions-res.xml +95 -0
- data/spec/fixtures/services/ad_group_criterion/get-req.xml +28 -0
- data/spec/fixtures/services/ad_group_criterion/get-res.xml +242 -0
- data/spec/fixtures/services/ad_group_criterion/mutate_add_criterion_keyword-req.xml +48 -0
- data/spec/fixtures/services/ad_group_criterion/mutate_add_criterion_keyword-res.xml +47 -0
- data/spec/fixtures/services/ad_group_criterion/mutate_add_criterion_placement-req.xml +35 -0
- data/spec/fixtures/services/ad_group_criterion/mutate_add_criterion_placement-res.xml +32 -0
- data/spec/fixtures/services/ad_group_criterion/mutate_add_negative_keyword-req.xml +37 -0
- data/spec/fixtures/services/ad_group_criterion/mutate_add_negative_keyword-res.xml +51 -0
- data/spec/fixtures/services/ad_param/mutate_set-req.xml +43 -0
- data/spec/fixtures/services/ad_param/mutate_set-res.xml +29 -0
- data/spec/fixtures/services/bulk_mutate_job/get-req.xml +36 -0
- data/spec/fixtures/services/bulk_mutate_job/get-res.xml +54 -0
- data/spec/fixtures/services/bulk_mutate_job/mutate-req.xml +69 -0
- data/spec/fixtures/services/bulk_mutate_job/mutate-res.xml +48 -0
- data/spec/fixtures/services/campaign/get-req.xml +37 -0
- data/spec/fixtures/services/campaign/get-res.xml +1986 -0
- data/spec/fixtures/services/campaign/mutate_add-req.xml +37 -0
- data/spec/fixtures/services/campaign/mutate_add-res.xml +42 -0
- data/spec/fixtures/services/error.xml +28 -0
- data/spec/fixtures/services/info/get_unit_count-req.xml +30 -0
- data/spec/fixtures/services/info/get_unit_count-res.xml +29 -0
- data/spec/fixtures/services/report_definition/mutate_add-req.xml +24 -0
- data/spec/fixtures/services/report_definition/mutate_add-req_orig.xml +45 -0
- data/spec/fixtures/services/targeting_idea/get-req-all-options.xml +57 -0
- data/spec/fixtures/services/targeting_idea/get-req.xml +60 -0
- data/spec/fixtures/services/targeting_idea/get-res.xml +3601 -0
- data/spec/fixtures/services/v13_account/get_account_info-req.xml +23 -0
- data/spec/fixtures/services/v13_account/get_account_info-res.xml +54 -0
- data/spec/fixtures/services/v13_account/get_client_accounts-req.xml +22 -0
- data/spec/fixtures/services/v13_account/get_client_accounts-res.xml +37 -0
- data/spec/fixtures/services/v13_report/get_all_jobs-req.xml +21 -0
- data/spec/fixtures/services/v13_report/get_all_jobs-res.xml +109 -0
- data/spec/fixtures/services/v13_report/schedule_report_job-req.xml +56 -0
- data/spec/fixtures/services/v13_report/schedule_report_job-res.xml +24 -0
- data/spec/sem4r/account_spec.rb +86 -0
- data/spec/sem4r/ad_group/ad_group_bids_spec.rb +67 -0
- data/spec/sem4r/ad_group/ad_group_service_spec.rb +66 -0
- data/spec/sem4r/ad_group/ad_group_spec.rb +212 -0
- data/spec/sem4r/ad_group_ad/ad_group_ad_operation_spec.rb +88 -0
- data/spec/sem4r/ad_group_ad/ad_group_ad_service_spec.rb +55 -0
- data/spec/sem4r/ad_group_ad/ad_group_ad_spec.rb +173 -0
- data/spec/sem4r/ad_group_criterion/ad_group_criterion_bids_spec.rb +60 -0
- data/spec/sem4r/ad_group_criterion/ad_group_criterion_service_spec.rb +55 -0
- data/spec/sem4r/ad_group_criterion/ad_group_criterion_spec.rb +103 -0
- data/spec/sem4r/ad_group_criterion/criterion_spec.rb +85 -0
- data/spec/sem4r/ad_param/ad_param_service_spec.rb +55 -0
- data/spec/sem4r/ad_param/ad_param_spec.rb +59 -0
- data/spec/sem4r/adwords_spec.rb +110 -0
- data/spec/sem4r/bulk_mutate_job/bulk_mutate_job_service_spec.rb +63 -0
- data/spec/sem4r/bulk_mutate_job/bulk_mutate_job_spec.rb +69 -0
- data/spec/sem4r/bulk_mutate_job/job_operation_spec.rb +48 -0
- data/spec/sem4r/campaign/campaign_service_spec.rb +66 -0
- data/spec/sem4r/campaign/campaign_spec.rb +105 -0
- data/spec/sem4r/cli/cli_spec.rb +71 -0
- data/spec/sem4r/credentials_spec.rb +65 -0
- data/spec/sem4r/report_definition/report_definition_service_spec.rb +44 -0
- data/spec/sem4r/report_definition/report_definition_spec.rb +105 -0
- data/spec/sem4r/rexml_parsing_spec.rb +103 -0
- data/spec/sem4r/services/service_spec.rb +36 -0
- data/spec/sem4r/services/soap_call_spec.rb +115 -0
- data/spec/sem4r/services/soap_message_v13_spec.rb +54 -0
- data/spec/sem4r/soap_attributes_spec.rb +116 -0
- data/spec/sem4r/targeting_idea/targeting_idea_selector_spec.rb +120 -0
- data/spec/sem4r/targeting_idea/targeting_idea_service_spec.rb +44 -0
- data/spec/sem4r/targeting_idea/targeting_idea_spec.rb +53 -0
- data/spec/sem4r/v13_account/account_service_spec.rb +60 -0
- data/spec/sem4r/v13_report/report_service_spec.rb +104 -0
- data/spec/sem4r/v13_report/report_spec.rb +79 -0
- data/spec/sem4r_spec_helper.rb +353 -0
- data/spec/spec_helper.rb +12 -0
- metadata +375 -0
@@ -0,0 +1,105 @@
|
|
1
|
+
# -------------------------------------------------------------------------
|
2
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#
|
23
|
+
# -------------------------------------------------------------------------
|
24
|
+
|
25
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
26
|
+
|
27
|
+
|
28
|
+
describe Campaign do
|
29
|
+
|
30
|
+
include Sem4rSpecHelper
|
31
|
+
|
32
|
+
before do
|
33
|
+
services = double("services")
|
34
|
+
stub_service_campaign(services)
|
35
|
+
stub_service_ad_group(services)
|
36
|
+
@account = stub_account(services)
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "campaign management" do
|
40
|
+
|
41
|
+
it "create should accept a block (instance_eval)" do
|
42
|
+
campaign = Campaign.create(@account) do
|
43
|
+
name "campaign"
|
44
|
+
end
|
45
|
+
campaign.name.should == "campaign"
|
46
|
+
campaign.id.should == 10
|
47
|
+
end
|
48
|
+
|
49
|
+
it "create should accept a block (call)" do
|
50
|
+
campaign = Campaign.create(@account) do |c|
|
51
|
+
c.name "campaign"
|
52
|
+
end
|
53
|
+
campaign.name.should == "campaign"
|
54
|
+
campaign.id.should == 10
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should parse xml (produced by google)" do
|
58
|
+
el = read_model("//entries", "services", "campaign", "get-res.xml")
|
59
|
+
campaign = Campaign.from_element(@account, el)
|
60
|
+
campaign.id.should == 53614
|
61
|
+
campaign.name.should == "test campaign"
|
62
|
+
campaign.status.should == "PAUSED"
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "adgroup management" do
|
68
|
+
|
69
|
+
it "should add an AdGroup with method 'ad_group' + block" do
|
70
|
+
campaign = Campaign.new(@account) do
|
71
|
+
name "campaign"
|
72
|
+
ad_group do
|
73
|
+
name "adgroup"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
campaign.ad_groups.length.should == 1
|
77
|
+
ad_group = campaign.ad_groups.first
|
78
|
+
ad_group.id.should == 10
|
79
|
+
ad_group.name.should == "adgroup"
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should add an AdGroup with method 'ad_group' + param" do
|
83
|
+
campaign = Campaign.new(@account) do
|
84
|
+
name "campaign"
|
85
|
+
ad_group "adgroup"
|
86
|
+
end
|
87
|
+
campaign.ad_groups.length.should == 1
|
88
|
+
ad_group = campaign.ad_groups.first
|
89
|
+
ad_group.id.should == 10
|
90
|
+
ad_group.name.should == "adgroup"
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
describe "bidding and budget" do
|
96
|
+
|
97
|
+
it "should accept a bidding_startegy" do
|
98
|
+
campaign = Campaign.create(@account) do
|
99
|
+
bidding_strategy "ManualCPM"
|
100
|
+
end
|
101
|
+
campaign.bidding_strategy.should == "ManualCPM"
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# -------------------------------------------------------------------------
|
2
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#
|
23
|
+
# -------------------------------------------------------------------------
|
24
|
+
|
25
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
26
|
+
|
27
|
+
|
28
|
+
describe "cli" do
|
29
|
+
include Sem4rSpecHelper
|
30
|
+
|
31
|
+
|
32
|
+
describe CliSem do
|
33
|
+
|
34
|
+
it "should show help" do
|
35
|
+
out = with_stdout_captured do
|
36
|
+
cli = CliSem.new
|
37
|
+
args = %w{ -h }
|
38
|
+
cli.parse_and_run(args)
|
39
|
+
end
|
40
|
+
out.should match("Usage")
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
describe CliCommonArgs do
|
46
|
+
|
47
|
+
it "should show help and exit" do
|
48
|
+
ret = true
|
49
|
+
out = with_stdout_captured do
|
50
|
+
args = %w{ -h }
|
51
|
+
cmd = CliCommonArgs.new
|
52
|
+
ret = cmd.parse(args)
|
53
|
+
end
|
54
|
+
out.should match("Usage")
|
55
|
+
ret.should be_false
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should show version and exit" do
|
59
|
+
ret = true
|
60
|
+
out = with_stdout_captured do
|
61
|
+
args = %w{ --version }
|
62
|
+
cmd = CliCommonArgs.new
|
63
|
+
ret = cmd.parse(args)
|
64
|
+
end
|
65
|
+
out.should match("sem4r version")
|
66
|
+
ret.should be_false
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# -------------------------------------------------------------------------
|
2
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#
|
23
|
+
# -------------------------------------------------------------------------
|
24
|
+
|
25
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
26
|
+
|
27
|
+
describe Credentials do
|
28
|
+
|
29
|
+
before do
|
30
|
+
@opts = {
|
31
|
+
:environment => "sandbox",
|
32
|
+
:email => "email",
|
33
|
+
:password => "password",
|
34
|
+
:developer_token => "dev_token"}
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should have getter" do
|
38
|
+
credentials = Credentials.new(@opts)
|
39
|
+
|
40
|
+
credentials.email.should == "email"
|
41
|
+
credentials.password.should == "password"
|
42
|
+
credentials.developer_token.should == "dev_token"
|
43
|
+
credentials.should_not be_mutable
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should be mutable" do
|
47
|
+
@opts[:mutable] = true
|
48
|
+
credentials = Credentials.new(@opts)
|
49
|
+
credentials.should be_mutable
|
50
|
+
end
|
51
|
+
|
52
|
+
it "requests authentication token should raise an exception without connector" do
|
53
|
+
credentials = Credentials.new(@opts)
|
54
|
+
lambda { credentials.authentication_token }.should raise_error
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should call connector when request for an authentication token" do
|
58
|
+
credentials = Credentials.new(@opts)
|
59
|
+
connector = SoapConnector.new
|
60
|
+
connector.should_receive(:authentication_token).and_return("auth_token")
|
61
|
+
credentials.connector= connector
|
62
|
+
credentials.authentication_token.should == "auth_token"
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# -------------------------------------------------------------------------
|
2
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#
|
23
|
+
# -------------------------------------------------------------------------
|
24
|
+
|
25
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
26
|
+
|
27
|
+
describe ReportDefinitionService do
|
28
|
+
include Sem4rSpecHelper
|
29
|
+
|
30
|
+
before do
|
31
|
+
@credentials = stub_credentials
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should define 'mutate'" do
|
35
|
+
response_xml = read_xml_file("services", "report_definition", "mutate-res.xml")
|
36
|
+
connector = mock("connector")
|
37
|
+
connector.should_receive(:send).and_return(response_xml)
|
38
|
+
service = ReportDefinitionService.new(connector)
|
39
|
+
soap_message = service.all( @credentials )
|
40
|
+
els = REXML::XPath.match( soap_message.response, "//getResponse")
|
41
|
+
els.should_not be_empty
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
# -------------------------------------------------------------------------
|
2
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#
|
23
|
+
# -------------------------------------------------------------------------
|
24
|
+
|
25
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
26
|
+
|
27
|
+
|
28
|
+
describe ReportDefinition do
|
29
|
+
|
30
|
+
include Sem4rSpecHelper
|
31
|
+
|
32
|
+
before do
|
33
|
+
services = double("services")
|
34
|
+
stub_service_report_definition(services)
|
35
|
+
@account = stub_account(services)
|
36
|
+
end
|
37
|
+
|
38
|
+
# it "create should accept a block (instance_eval)" do
|
39
|
+
# rd = ReportDefinition.create(@account) do
|
40
|
+
# name "report"
|
41
|
+
# end
|
42
|
+
# rd.name.should == "report"
|
43
|
+
# rd.id.should == 10
|
44
|
+
# end
|
45
|
+
|
46
|
+
|
47
|
+
# it "create should accept a block (call)" do
|
48
|
+
# adgroup = AdGroup.create(@campaign) do |g|
|
49
|
+
# g.name "adgroup"
|
50
|
+
# end
|
51
|
+
# adgroup.name.should == "adgroup"
|
52
|
+
# adgroup.id.should == 10
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# it "create should accept a manual cpc bids" do
|
56
|
+
# adgroup = AdGroup.create(@campaign) do
|
57
|
+
# name "sem4r library"
|
58
|
+
# manual_cpc_bids do
|
59
|
+
# keyword_max_cpc 10000
|
60
|
+
# end
|
61
|
+
# end
|
62
|
+
# adgroup.bids.should be_instance_of(ManualCPCAdGroupBids)
|
63
|
+
# end
|
64
|
+
#
|
65
|
+
# it "create should accept a manual cpm bids" do
|
66
|
+
# adgroup = AdGroup.create(@campaign) do
|
67
|
+
# name "sem4r library"
|
68
|
+
# manual_cpm_bids do
|
69
|
+
# max_cpm 10000
|
70
|
+
# end
|
71
|
+
# end
|
72
|
+
# adgroup.bids.should be_instance_of(ManualCPMAdGroupBids)
|
73
|
+
# end
|
74
|
+
#
|
75
|
+
|
76
|
+
it "should build xml (input for google)" do
|
77
|
+
report_definition = ReportDefinition.new(@account) do
|
78
|
+
name "report"
|
79
|
+
# manual_cpc_bids do
|
80
|
+
# keyword_max_cpc 20000000
|
81
|
+
# site_max_cpc 30000000
|
82
|
+
# end
|
83
|
+
end
|
84
|
+
exepected_xml = read_model("//operand", "services", "report_definition", "mutate_add-req.xml")
|
85
|
+
report_definition.to_xml("operand").should xml_equivalent(exepected_xml)
|
86
|
+
end
|
87
|
+
|
88
|
+
#
|
89
|
+
# it "should parse xml (produced by google)" do
|
90
|
+
# el = read_model("//entries", "services", "ad_group", "get-first-res.xml")
|
91
|
+
# adgroup = AdGroup.from_element(@campaign, el)
|
92
|
+
# adgroup.id.should == 3060217923
|
93
|
+
# adgroup.name.should == "test adgroup"
|
94
|
+
# adgroup.status.should == "ENABLED"
|
95
|
+
# end
|
96
|
+
#
|
97
|
+
# it "should parse xml (produced by google) with manual cpm bids" do
|
98
|
+
# el = read_model("//entries", "services", "ad_group", "get-manual-cpm-bids-res.xml")
|
99
|
+
# adgroup = AdGroup.from_element(@campaign, el)
|
100
|
+
# adgroup.bids.should be_instance_of(ManualCPMAdGroupBids)
|
101
|
+
# end
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# -------------------------------------------------------------------------
|
2
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#
|
23
|
+
# -------------------------------------------------------------------------
|
24
|
+
|
25
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
26
|
+
|
27
|
+
describe "Test Parsing with REXML" do
|
28
|
+
include Sem4rSpecHelper
|
29
|
+
|
30
|
+
|
31
|
+
it "ddd" do
|
32
|
+
pending "test"
|
33
|
+
xml_document = read_xml_document("services", "ad_group_ad", "mutate_add_two_criterions-res.xml")
|
34
|
+
els = REXML::XPath.match( xml_document, "//mutateResponse/rval/value/ad/id")
|
35
|
+
els.each {|e| puts e.text.strip.to_i }
|
36
|
+
end
|
37
|
+
|
38
|
+
it "test_account_get_client_accounts" do
|
39
|
+
xml_document = read_xml_document("services", "v13_account", "get_client_accounts-res.xml")
|
40
|
+
els = REXML::XPath.match( xml_document, "//getClientAccountsReturn")
|
41
|
+
els.length.should == 5
|
42
|
+
end
|
43
|
+
|
44
|
+
it "test_campaign_get" do
|
45
|
+
xml_document = read_xml_document("services", "campaign", "get-res.xml")
|
46
|
+
rval = REXML::XPath.first( xml_document, "//getResponse/rval")
|
47
|
+
els = REXML::XPath.match( rval, "entries")
|
48
|
+
|
49
|
+
ids_expected =
|
50
|
+
["53614", "53615", "53616", "54034", "54035", "55405", "55420", "56761",
|
51
|
+
"62742", "62743", "62744", "62745", "62746", "62747", "62748"]
|
52
|
+
|
53
|
+
names_expected = [
|
54
|
+
"test campaign",
|
55
|
+
"campaign 2010-02-06 13:43:10 +0100",
|
56
|
+
"campaign 2010-02-06 13:49:21 +0100",
|
57
|
+
"campaign 2010-02-07 19:35:49 +0100",
|
58
|
+
"campaign 2010-02-07 19:39:17 +0100",
|
59
|
+
"campaign 2010-02-08 23:51:06 +0100",
|
60
|
+
"campaign 2010-02-08 23:55:21 +0100",
|
61
|
+
"campaign 2010-02-09 22:17:19 +0100",
|
62
|
+
"campaign 2010-02-13 09:29:08 +0100",
|
63
|
+
"campaign 2010-02-13 09:37:09 +0100",
|
64
|
+
"campaign 2010-02-13 09:37:58 +0100",
|
65
|
+
"campaign 2010-02-13 09:38:20 +0100",
|
66
|
+
"campaign 2010-02-13 09:38:39 +0100",
|
67
|
+
"campaign 2010-02-13 09:39:14 +0100",
|
68
|
+
"campaign 2010-02-13 09:39:46 +0100"]
|
69
|
+
|
70
|
+
ids = els.map{|el| el.elements["id"].text.strip }
|
71
|
+
names = els.map{|el| el.elements["name"].text.strip }
|
72
|
+
|
73
|
+
ids_expected.should == ids
|
74
|
+
names_expected.should == names
|
75
|
+
end
|
76
|
+
|
77
|
+
it "test_adgroup_criterion_get" do
|
78
|
+
xml_document = read_xml_document("services", "ad_group_criterion", "get-res.xml")
|
79
|
+
rval = REXML::XPath.first( xml_document, "//getResponse/rval")
|
80
|
+
|
81
|
+
el = REXML::XPath.first( rval, "entries/criterion[@xsi:type='Keyword']")
|
82
|
+
|
83
|
+
el.elements["id"].text.should == "11536082"
|
84
|
+
el.elements["text"].text.should == "pippo"
|
85
|
+
el.elements["matchType"].text.should == "BROAD"
|
86
|
+
end
|
87
|
+
|
88
|
+
it "test_info_get" do
|
89
|
+
xml_document = read_xml_document("services", "info", "get_unit_count-res.xml")
|
90
|
+
|
91
|
+
response_header = REXML::XPath.first(xml_document, "//ResponseHeader")
|
92
|
+
response_header.elements["operations"].text.strip.should == "1"
|
93
|
+
response_header.elements["responseTime"].text.strip.should == "173"
|
94
|
+
response_header.elements["units"].text.strip.should == "1"
|
95
|
+
|
96
|
+
cost = REXML::XPath.first( xml_document, "//getResponse/rval/cost")
|
97
|
+
cost.text.strip.should == "100"
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# -------------------------------------------------------------------------
|
2
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#
|
23
|
+
# -------------------------------------------------------------------------
|
24
|
+
|
25
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
26
|
+
|
27
|
+
describe Service do
|
28
|
+
include Sem4rSpecHelper
|
29
|
+
|
30
|
+
it "should contains ad_group service" do
|
31
|
+
connector = mock("connector")
|
32
|
+
s = Service.new(connector)
|
33
|
+
s.ad_group.should_not == nil
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# -------------------------------------------------------------------------
|
2
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#
|
23
|
+
# -------------------------------------------------------------------------
|
24
|
+
|
25
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
26
|
+
|
27
|
+
describe SoapCall do
|
28
|
+
include Sem4rSpecHelper
|
29
|
+
|
30
|
+
def mock_connector
|
31
|
+
mock("connector", :send => "send")
|
32
|
+
end
|
33
|
+
|
34
|
+
class TSoapService
|
35
|
+
include SoapCall
|
36
|
+
|
37
|
+
def initialize(connector)
|
38
|
+
@connector = connector
|
39
|
+
end
|
40
|
+
|
41
|
+
soap_call_v2009 :get, :mutate => false
|
42
|
+
soap_call_v2009 :get_with_arg, :mutate => false
|
43
|
+
soap_call_v2009 :mutate
|
44
|
+
soap_call_v2009 :mutate_bis, :mutate => true
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
|
49
|
+
def _get(xml)
|
50
|
+
<<-EOFS
|
51
|
+
<s:get>#{xml}</s:get>
|
52
|
+
EOFS
|
53
|
+
end
|
54
|
+
|
55
|
+
def _get_with_arg(a1)
|
56
|
+
"_get_with_arg"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
it "should define a new method" do
|
62
|
+
t = TSoapService.new(mock_connector)
|
63
|
+
r = t.methods.grep /^get$/
|
64
|
+
# t.methods.should include(:get)
|
65
|
+
r.length.should == 1
|
66
|
+
end
|
67
|
+
|
68
|
+
# it "should add a parameter to private method" do
|
69
|
+
# pending "test"
|
70
|
+
# get = TSoapService.instance_method(:get)
|
71
|
+
# _get = TSoapService.instance_method(:_get)
|
72
|
+
# get.arity.should == _get.arity + 1
|
73
|
+
# end
|
74
|
+
|
75
|
+
it "calling 'get' should call private method _get" do
|
76
|
+
pending "Test"
|
77
|
+
credentials = stub_credentials
|
78
|
+
@connector = mock("connector", :send => "send")
|
79
|
+
# @connector.should_receive().with("get")
|
80
|
+
t = TSoapService.new(@connector)
|
81
|
+
t.should_receive(:_get).with("foo").and_return("get")
|
82
|
+
soap_message = t.get(credentials, "foo")
|
83
|
+
# soap_message.response.should == "send"
|
84
|
+
end
|
85
|
+
|
86
|
+
it "calling 'get_with_arg' should call private method _get_with_arg" do
|
87
|
+
credentials = stub_credentials
|
88
|
+
t = TSoapService.new(mock_connector)
|
89
|
+
t.get_with_arg(credentials, "foo")
|
90
|
+
end
|
91
|
+
|
92
|
+
it "calling 'mutate' should raise an exception with read_only profile" do
|
93
|
+
credentials = stub_credentials
|
94
|
+
credentials.should_receive(:mutable?).and_return(false)
|
95
|
+
t = TSoapService.new(mock_connector)
|
96
|
+
t.should_not_receive(:_mutate)
|
97
|
+
lambda{ t.mutate(credentials, "foo")}.should raise_error(RuntimeError)
|
98
|
+
end
|
99
|
+
|
100
|
+
it "call 'mutate' should call private methods _mutate with the right profile" do
|
101
|
+
credentials = stub_credentials
|
102
|
+
credentials.should_receive(:mutable?).and_return(true)
|
103
|
+
t = TSoapService.new(mock_connector)
|
104
|
+
t.should_receive(:_mutate).with("foo").and_return("")
|
105
|
+
t.mutate(credentials, "foo")
|
106
|
+
end
|
107
|
+
|
108
|
+
it "call 'mutate_bis' should raise an exception with read_only profile" do
|
109
|
+
credentials = stub_credentials
|
110
|
+
credentials.should_receive(:mutable?).and_return(false)
|
111
|
+
t = TSoapService.new(mock_connector)
|
112
|
+
t.should_not_receive(:_mutate_bis)
|
113
|
+
lambda{ t.mutate_bis(credentials, "foo")}.should raise_error(RuntimeError)
|
114
|
+
end
|
115
|
+
end
|