daengine 0.6.5 → 0.6.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -0
- data/app/controllers/digital_assets_controller.rb +4 -2
- data/app/models/digital_asset.rb +5 -6
- data/app/models/service_digital_asset.rb +112 -0
- data/app/service/digital_asset_lookup_service.rb +2 -2
- data/bin/process_assets +17 -15
- data/config/routes.rb +1 -0
- data/lib/daengine.rb +4 -2
- data/lib/daengine/digital_asset_processor.rb +8 -2
- data/lib/daengine/http_client.rb +99 -0
- data/lib/daengine/teamsite_metadata_processor.rb +315 -0
- data/lib/daengine/version.rb +1 -1
- data/spec/acceptance/digital_assets_spec.rb +1 -1
- data/spec/dummy/log/test.log +300 -0
- data/spec/factories.rb +25 -5
- data/spec/lib/digital_asset_processor_spec.rb +5 -3
- data/spec/lib/teamsite_metadata_processor_spec.rb +236 -0
- data/spec/mock_data/daengine.yml +1 -1
- data/spec/mock_data/taxonomy/taxonomyengine.yml +1 -1
- data/spec/models/service_digital_asset_spec.rb +136 -0
- metadata +39 -4
data/lib/daengine/version.rb
CHANGED
@@ -83,7 +83,7 @@ resource "Digital Assets", :api => true do
|
|
83
83
|
let(:digital_asset) {da.attributes}
|
84
84
|
example "insert a digital_asset if not found" do
|
85
85
|
do_request()
|
86
|
-
status.should eq(
|
86
|
+
status.should eq(201)
|
87
87
|
inserted = DigitalAsset.find('new-digital-asset-id')
|
88
88
|
expect(inserted.present?).to be true
|
89
89
|
end
|
data/spec/dummy/log/test.log
CHANGED
@@ -8900,3 +8900,303 @@ Completed 406 Not Acceptable in 1.0ms
|
|
8900
8900
|
Processing by DigitalAssetsController#search as HTML
|
8901
8901
|
Parameters: {"digital_asset_id"=>"blargh-blargh-blargh", "title"=>"Doc Title"}
|
8902
8902
|
Completed 406 Not Acceptable in 1.0ms
|
8903
|
+
Started GET "/digital_assets" for 127.0.0.1 at 2014-02-06 08:51:26 -0700
|
8904
|
+
Processing by DigitalAssetsController#index as JSON
|
8905
|
+
Completed 200 OK in 26.0ms (Views: 3.0ms)
|
8906
|
+
Started GET "/digital_assets?digital_asset_id=id-foobar-permanent-1" for 127.0.0.1 at 2014-02-06 08:51:26 -0700
|
8907
|
+
Processing by DigitalAssetsController#index as JSON
|
8908
|
+
Parameters: {"digital_asset_id"=>"id-foobar-permanent-1"}
|
8909
|
+
Completed 200 OK in 92.0ms (Views: 87.0ms)
|
8910
|
+
Started GET "/digital_assets?fund=00200" for 127.0.0.1 at 2014-02-06 08:51:26 -0700
|
8911
|
+
Processing by DigitalAssetsController#index as JSON
|
8912
|
+
Parameters: {"fund"=>"00200"}
|
8913
|
+
Completed 200 OK in 63.0ms (Views: 58.0ms)
|
8914
|
+
Started GET "/digital_assets?digital_asset_id=id-foobar-permanent-4" for 127.0.0.1 at 2014-02-06 08:51:26 -0700
|
8915
|
+
Processing by DigitalAssetsController#index as JSON
|
8916
|
+
Parameters: {"digital_asset_id"=>"id-foobar-permanent-4"}
|
8917
|
+
Completed 200 OK in 30.0ms (Views: 26.0ms)
|
8918
|
+
Started GET "/digital_assets?path=%2Fsome%2Fother%2Fpath.pdf" for 127.0.0.1 at 2014-02-06 08:51:26 -0700
|
8919
|
+
Processing by DigitalAssetsController#index as JSON
|
8920
|
+
Parameters: {"path"=>"/some/other/path.pdf"}
|
8921
|
+
Completed 200 OK in 31.0ms (Views: 26.0ms)
|
8922
|
+
Started GET "/digital_assets?digital_asset_id=id-foobar-permanent-6" for 127.0.0.1 at 2014-02-06 08:51:26 -0700
|
8923
|
+
Processing by DigitalAssetsController#index as JSON
|
8924
|
+
Parameters: {"digital_asset_id"=>"id-foobar-permanent-6"}
|
8925
|
+
Completed 200 OK in 32.0ms (Views: 27.0ms)
|
8926
|
+
Started GET "/digital_assets?published=2014-02-06+13%3A51%3A27+UTC" for 127.0.0.1 at 2014-02-06 08:51:27 -0700
|
8927
|
+
Processing by DigitalAssetsController#index as JSON
|
8928
|
+
Parameters: {"published"=>"2014-02-06 13:51:27 UTC"}
|
8929
|
+
Completed 200 OK in 66.0ms (Views: 23.0ms)
|
8930
|
+
Started GET "/digital_assets/foo-bar-id" for 127.0.0.1 at 2014-02-06 08:51:27 -0700
|
8931
|
+
Processing by DigitalAssetsController#show as JSON
|
8932
|
+
Parameters: {"id"=>"foo-bar-id"}
|
8933
|
+
Completed 200 OK in 50.0ms (Views: 35.0ms)
|
8934
|
+
Started GET "/digital_assets/not-found-doc" for 127.0.0.1 at 2014-02-06 08:51:27 -0700
|
8935
|
+
Processing by DigitalAssetsController#show as JSON
|
8936
|
+
Parameters: {"id"=>"not-found-doc"}
|
8937
|
+
Completed 404 Not Found in 58.0ms (Views: 1.0ms)
|
8938
|
+
Started PUT "/digital_assets/foo-bar-digital-asset-id" for 127.0.0.1 at 2014-02-06 08:51:27 -0700
|
8939
|
+
Processing by DigitalAssetsController#update as JSON
|
8940
|
+
Parameters: {"digital_asset"=>{"audiences"=>["investor"], "omniture_codes"=>["KOW2MY24D"], "orderable"=>"false", "pages"=>"1", "fund_codes"=>["00200", "00190", "00210"], "_id"=>"foo-bar-digital-asset-id", "title"=>"another title", "changed_at"=>"2014-02-04 15:51:26 UTC", "digital_asset_id"=>"foo-bar-digital-asset-id", "published_at"=>"2014-01-27 15:51:26 UTC", "expires_at"=>"2014-04-06 15:51:26 UTC", "sami_code"=>"IL1111.077", "business_owner"=>"biz owner", "path"=>"/9/foo/bar.txt", "finra_path"=>"/path/finradoc/10/foo/bar.txt", "legacy_path"=>"/oldpath/10/foo/bar.txt", "doc_changed_at"=>"2014-02-04 15:51:26 UTC", "content_type"=>"fact_sheet", "updated_at"=>"2014-02-06 15:51:27 UTC", "created_at"=>"2014-02-06 15:51:27 UTC"}, "id"=>"foo-bar-digital-asset-id"}
|
8941
|
+
Completed 200 OK in 20.0ms
|
8942
|
+
Started POST "/digital_assets" for 127.0.0.1 at 2014-02-06 08:51:27 -0700
|
8943
|
+
Processing by DigitalAssetsController#create as JSON
|
8944
|
+
Parameters: {"digital_asset"=>{"audiences"=>["investor"], "omniture_codes"=>["KOW2MY24D"], "orderable"=>"false", "pages"=>"1", "fund_codes"=>["00200", "00190", "00210"], "_id"=>"52f3af7fbed4827081c2c1ec", "title"=>"Doc Title", "changed_at"=>"2014-02-04 15:51:26 UTC", "digital_asset_id"=>"new-digital-asset-id", "published_at"=>"2014-01-27 15:51:26 UTC", "expires_at"=>"2014-04-06 15:51:26 UTC", "sami_code"=>"IL1111.077", "business_owner"=>"biz owner", "path"=>"/10/foo/bar.txt", "finra_path"=>"/path/finradoc/11/foo/bar.txt", "legacy_path"=>"/oldpath/11/foo/bar.txt", "doc_changed_at"=>"2014-02-04 15:51:26 UTC", "content_type"=>"fact_sheet"}}
|
8945
|
+
Completed 201 Created in 29.0ms
|
8946
|
+
Started DELETE "/digital_assets/foo-bar-digital-asset-id" for 127.0.0.1 at 2014-02-06 08:51:27 -0700
|
8947
|
+
Processing by DigitalAssetsController#destroy as JSON
|
8948
|
+
Parameters: {"id"=>"foo-bar-digital-asset-id"}
|
8949
|
+
Completed 200 OK in 5.0ms
|
8950
|
+
Started POST "/digital_assets/updated_time" for 127.0.0.1 at 2014-02-06 08:51:27 -0700
|
8951
|
+
Processing by DigitalAssetsController#updated_time as JSON
|
8952
|
+
Parameters: {"ids"=>["id-1", "id-2", "id-3", "id-4"]}
|
8953
|
+
Completed 200 OK in 25.0ms (Views: 0.0ms)
|
8954
|
+
Processing by DigitalAssetsController#index as HTML
|
8955
|
+
Completed 406 Not Acceptable in 1.0ms
|
8956
|
+
Processing by DigitalAssetsController#show as HTML
|
8957
|
+
Parameters: {"id"=>"id-foobar-permanent-9"}
|
8958
|
+
Completed 406 Not Acceptable in 7.0ms
|
8959
|
+
Processing by DigitalAssetsController#show as HTML
|
8960
|
+
Parameters: {"id"=>"IL1111.077"}
|
8961
|
+
Completed 406 Not Acceptable in 6.0ms
|
8962
|
+
Processing by DigitalAssetsController#show as HTML
|
8963
|
+
Parameters: {"id"=>"IL1111.077"}
|
8964
|
+
Completed 406 Not Acceptable in 5.0ms
|
8965
|
+
Processing by DigitalAssetsController#show as HTML
|
8966
|
+
Parameters: {"id"=>"id-foobar-permanent-13"}
|
8967
|
+
Completed 406 Not Acceptable in 4.0ms
|
8968
|
+
Processing by DigitalAssetsController#search as HTML
|
8969
|
+
Completed 406 Not Acceptable in 1.0ms
|
8970
|
+
Processing by DigitalAssetsController#search as HTML
|
8971
|
+
Parameters: {"path"=>"/one/off.path"}
|
8972
|
+
Completed 406 Not Acceptable in 2.0ms
|
8973
|
+
Processing by DigitalAssetsController#search as HTML
|
8974
|
+
Parameters: {"doctype"=>"fact_sheet"}
|
8975
|
+
Completed 406 Not Acceptable in 2.0ms
|
8976
|
+
Processing by DigitalAssetsController#search as HTML
|
8977
|
+
Parameters: {"doctype"=>["fact_sheet", "prospectus"]}
|
8978
|
+
Completed 406 Not Acceptable in 2.0ms
|
8979
|
+
Processing by DigitalAssetsController#search as HTML
|
8980
|
+
Parameters: {"sami"=>"SOMETHING.001"}
|
8981
|
+
Completed 406 Not Acceptable in 2.0ms
|
8982
|
+
Processing by DigitalAssetsController#search as HTML
|
8983
|
+
Parameters: {"audience"=>"492"}
|
8984
|
+
Completed 406 Not Acceptable in 1.0ms
|
8985
|
+
Processing by DigitalAssetsController#search as HTML
|
8986
|
+
Parameters: {"title"=>"Doc Title"}
|
8987
|
+
Completed 406 Not Acceptable in 1.0ms
|
8988
|
+
Processing by DigitalAssetsController#search as HTML
|
8989
|
+
Parameters: {"digital_asset_id"=>"id-foobar-permanent-35"}
|
8990
|
+
Completed 406 Not Acceptable in 1.0ms
|
8991
|
+
Processing by DigitalAssetsController#search as HTML
|
8992
|
+
Parameters: {"business_owner"=>"biz owner"}
|
8993
|
+
Completed 406 Not Acceptable in 1.0ms
|
8994
|
+
Processing by DigitalAssetsController#search as HTML
|
8995
|
+
Parameters: {"digital_asset_id"=>"id-foobar-permanent-42", "title"=>"Doc Title"}
|
8996
|
+
Completed 406 Not Acceptable in 4.0ms
|
8997
|
+
Processing by DigitalAssetsController#search as HTML
|
8998
|
+
Parameters: {"title"=>"Doc Title", "audiences"=>["investor"], "sami"=>"IL1111.077"}
|
8999
|
+
Completed 406 Not Acceptable in 2.0ms
|
9000
|
+
Processing by DigitalAssetsController#search as HTML
|
9001
|
+
Parameters: {"digital_asset_id"=>"blargh-blargh-blargh", "title"=>"Doc Title"}
|
9002
|
+
Completed 406 Not Acceptable in 1.0ms
|
9003
|
+
Started GET "/digital_assets" for 127.0.0.1 at 2014-02-06 13:54:41 -0700
|
9004
|
+
Processing by DigitalAssetsController#index as JSON
|
9005
|
+
Completed 200 OK in 27.0ms (Views: 3.0ms)
|
9006
|
+
Started GET "/digital_assets?digital_asset_id=id-foobar-permanent-1" for 127.0.0.1 at 2014-02-06 13:54:41 -0700
|
9007
|
+
Processing by DigitalAssetsController#index as JSON
|
9008
|
+
Parameters: {"digital_asset_id"=>"id-foobar-permanent-1"}
|
9009
|
+
Completed 200 OK in 90.0ms (Views: 83.0ms)
|
9010
|
+
Started GET "/digital_assets?fund=00200" for 127.0.0.1 at 2014-02-06 13:54:41 -0700
|
9011
|
+
Processing by DigitalAssetsController#index as JSON
|
9012
|
+
Parameters: {"fund"=>"00200"}
|
9013
|
+
Completed 200 OK in 57.0ms (Views: 50.0ms)
|
9014
|
+
Started GET "/digital_assets?digital_asset_id=id-foobar-permanent-4" for 127.0.0.1 at 2014-02-06 13:54:41 -0700
|
9015
|
+
Processing by DigitalAssetsController#index as JSON
|
9016
|
+
Parameters: {"digital_asset_id"=>"id-foobar-permanent-4"}
|
9017
|
+
Completed 200 OK in 33.0ms (Views: 28.0ms)
|
9018
|
+
Started GET "/digital_assets?path=%2Fsome%2Fother%2Fpath.pdf" for 127.0.0.1 at 2014-02-06 13:54:41 -0700
|
9019
|
+
Processing by DigitalAssetsController#index as JSON
|
9020
|
+
Parameters: {"path"=>"/some/other/path.pdf"}
|
9021
|
+
Completed 200 OK in 29.0ms (Views: 25.0ms)
|
9022
|
+
Started GET "/digital_assets?digital_asset_id=id-foobar-permanent-6" for 127.0.0.1 at 2014-02-06 13:54:41 -0700
|
9023
|
+
Processing by DigitalAssetsController#index as JSON
|
9024
|
+
Parameters: {"digital_asset_id"=>"id-foobar-permanent-6"}
|
9025
|
+
Completed 200 OK in 32.0ms (Views: 28.0ms)
|
9026
|
+
Started GET "/digital_assets?published=2014-02-06+18%3A54%3A41+UTC" for 127.0.0.1 at 2014-02-06 13:54:41 -0700
|
9027
|
+
Processing by DigitalAssetsController#index as JSON
|
9028
|
+
Parameters: {"published"=>"2014-02-06 18:54:41 UTC"}
|
9029
|
+
Completed 200 OK in 52.0ms (Views: 23.0ms)
|
9030
|
+
Started GET "/digital_assets/foo-bar-id" for 127.0.0.1 at 2014-02-06 13:54:41 -0700
|
9031
|
+
Processing by DigitalAssetsController#show as JSON
|
9032
|
+
Parameters: {"id"=>"foo-bar-id"}
|
9033
|
+
Completed 200 OK in 34.0ms (Views: 19.0ms)
|
9034
|
+
Started GET "/digital_assets/not-found-doc" for 127.0.0.1 at 2014-02-06 13:54:41 -0700
|
9035
|
+
Processing by DigitalAssetsController#show as JSON
|
9036
|
+
Parameters: {"id"=>"not-found-doc"}
|
9037
|
+
Completed 404 Not Found in 80.0ms (Views: 2.0ms)
|
9038
|
+
Started PUT "/digital_assets/foo-bar-digital-asset-id" for 127.0.0.1 at 2014-02-06 13:54:42 -0700
|
9039
|
+
Processing by DigitalAssetsController#update as JSON
|
9040
|
+
Parameters: {"digital_asset"=>{"audiences"=>["investor"], "omniture_codes"=>["KOW2MY24D"], "orderable"=>"false", "pages"=>"1", "fund_codes"=>["00200", "00190", "00210"], "_id"=>"foo-bar-digital-asset-id", "title"=>"another title", "changed_at"=>"2014-02-04 20:54:40 UTC", "digital_asset_id"=>"foo-bar-digital-asset-id", "published_at"=>"2014-01-27 20:54:40 UTC", "expires_at"=>"2014-04-06 20:54:40 UTC", "sami_code"=>"IL1111.077", "business_owner"=>"biz owner", "path"=>"/9/foo/bar.txt", "finra_path"=>"/path/finradoc/10/foo/bar.txt", "legacy_path"=>"/oldpath/10/foo/bar.txt", "doc_changed_at"=>"2014-02-04 20:54:40 UTC", "content_type"=>"fact_sheet", "updated_at"=>"2014-02-06 20:54:42 UTC", "created_at"=>"2014-02-06 20:54:42 UTC"}, "id"=>"foo-bar-digital-asset-id"}
|
9041
|
+
Completed 200 OK in 23.0ms
|
9042
|
+
Started POST "/digital_assets" for 127.0.0.1 at 2014-02-06 13:54:42 -0700
|
9043
|
+
Processing by DigitalAssetsController#create as JSON
|
9044
|
+
Parameters: {"digital_asset"=>{"audiences"=>["investor"], "omniture_codes"=>["KOW2MY24D"], "orderable"=>"false", "pages"=>"1", "fund_codes"=>["00200", "00190", "00210"], "_id"=>"52f3f69255b605263bb43c0f", "title"=>"Doc Title", "changed_at"=>"2014-02-04 20:54:40 UTC", "digital_asset_id"=>"new-digital-asset-id", "published_at"=>"2014-01-27 20:54:40 UTC", "expires_at"=>"2014-04-06 20:54:40 UTC", "sami_code"=>"IL1111.077", "business_owner"=>"biz owner", "path"=>"/10/foo/bar.txt", "finra_path"=>"/path/finradoc/11/foo/bar.txt", "legacy_path"=>"/oldpath/11/foo/bar.txt", "doc_changed_at"=>"2014-02-04 20:54:40 UTC", "content_type"=>"fact_sheet"}}
|
9045
|
+
Completed 201 Created in 28.0ms
|
9046
|
+
Started DELETE "/digital_assets/foo-bar-digital-asset-id" for 127.0.0.1 at 2014-02-06 13:54:42 -0700
|
9047
|
+
Processing by DigitalAssetsController#destroy as JSON
|
9048
|
+
Parameters: {"id"=>"foo-bar-digital-asset-id"}
|
9049
|
+
Completed 200 OK in 6.0ms
|
9050
|
+
Started POST "/digital_assets/updated_time" for 127.0.0.1 at 2014-02-06 13:54:42 -0700
|
9051
|
+
Processing by DigitalAssetsController#updated_time as JSON
|
9052
|
+
Parameters: {"ids"=>["id-1", "id-2", "id-3", "id-4"]}
|
9053
|
+
Completed 200 OK in 24.0ms (Views: 0.0ms)
|
9054
|
+
Processing by DigitalAssetsController#index as HTML
|
9055
|
+
Completed 406 Not Acceptable in 1.0ms
|
9056
|
+
Processing by DigitalAssetsController#show as HTML
|
9057
|
+
Parameters: {"id"=>"id-foobar-permanent-9"}
|
9058
|
+
Completed 406 Not Acceptable in 5.0ms
|
9059
|
+
Processing by DigitalAssetsController#show as HTML
|
9060
|
+
Parameters: {"id"=>"IL1111.077"}
|
9061
|
+
Completed 406 Not Acceptable in 4.0ms
|
9062
|
+
Processing by DigitalAssetsController#show as HTML
|
9063
|
+
Parameters: {"id"=>"IL1111.077"}
|
9064
|
+
Completed 406 Not Acceptable in 4.0ms
|
9065
|
+
Processing by DigitalAssetsController#show as HTML
|
9066
|
+
Parameters: {"id"=>"id-foobar-permanent-13"}
|
9067
|
+
Completed 406 Not Acceptable in 4.0ms
|
9068
|
+
Processing by DigitalAssetsController#search as HTML
|
9069
|
+
Completed 406 Not Acceptable in 1.0ms
|
9070
|
+
Processing by DigitalAssetsController#search as HTML
|
9071
|
+
Parameters: {"path"=>"/one/off.path"}
|
9072
|
+
Completed 406 Not Acceptable in 1.0ms
|
9073
|
+
Processing by DigitalAssetsController#search as HTML
|
9074
|
+
Parameters: {"doctype"=>"fact_sheet"}
|
9075
|
+
Completed 406 Not Acceptable in 5.0ms
|
9076
|
+
Processing by DigitalAssetsController#search as HTML
|
9077
|
+
Parameters: {"doctype"=>["fact_sheet", "prospectus"]}
|
9078
|
+
Completed 406 Not Acceptable in 2.0ms
|
9079
|
+
Processing by DigitalAssetsController#search as HTML
|
9080
|
+
Parameters: {"sami"=>"SOMETHING.001"}
|
9081
|
+
Completed 406 Not Acceptable in 1.0ms
|
9082
|
+
Processing by DigitalAssetsController#search as HTML
|
9083
|
+
Parameters: {"audience"=>"492"}
|
9084
|
+
Completed 406 Not Acceptable in 1.0ms
|
9085
|
+
Processing by DigitalAssetsController#search as HTML
|
9086
|
+
Parameters: {"title"=>"Doc Title"}
|
9087
|
+
Completed 406 Not Acceptable in 2.0ms
|
9088
|
+
Processing by DigitalAssetsController#search as HTML
|
9089
|
+
Parameters: {"digital_asset_id"=>"id-foobar-permanent-35"}
|
9090
|
+
Completed 406 Not Acceptable in 2.0ms
|
9091
|
+
Processing by DigitalAssetsController#search as HTML
|
9092
|
+
Parameters: {"business_owner"=>"biz owner"}
|
9093
|
+
Completed 406 Not Acceptable in 2.0ms
|
9094
|
+
Processing by DigitalAssetsController#search as HTML
|
9095
|
+
Parameters: {"digital_asset_id"=>"id-foobar-permanent-42", "title"=>"Doc Title"}
|
9096
|
+
Completed 406 Not Acceptable in 3.0ms
|
9097
|
+
Processing by DigitalAssetsController#search as HTML
|
9098
|
+
Parameters: {"title"=>"Doc Title", "audiences"=>["investor"], "sami"=>"IL1111.077"}
|
9099
|
+
Completed 406 Not Acceptable in 2.0ms
|
9100
|
+
Processing by DigitalAssetsController#search as HTML
|
9101
|
+
Parameters: {"digital_asset_id"=>"blargh-blargh-blargh", "title"=>"Doc Title"}
|
9102
|
+
Completed 406 Not Acceptable in 1.0ms
|
9103
|
+
Started GET "/digital_assets" for 127.0.0.1 at 2014-02-07 13:23:08 -0700
|
9104
|
+
Processing by DigitalAssetsController#index as JSON
|
9105
|
+
Completed 200 OK in 26.0ms (Views: 3.0ms)
|
9106
|
+
Started GET "/digital_assets?digital_asset_id=id-foobar-permanent-1" for 127.0.0.1 at 2014-02-07 13:23:08 -0700
|
9107
|
+
Processing by DigitalAssetsController#index as JSON
|
9108
|
+
Parameters: {"digital_asset_id"=>"id-foobar-permanent-1"}
|
9109
|
+
Completed 200 OK in 48.0ms (Views: 43.0ms)
|
9110
|
+
Started GET "/digital_assets?fund=00200" for 127.0.0.1 at 2014-02-07 13:23:08 -0700
|
9111
|
+
Processing by DigitalAssetsController#index as JSON
|
9112
|
+
Parameters: {"fund"=>"00200"}
|
9113
|
+
Completed 200 OK in 66.0ms (Views: 58.0ms)
|
9114
|
+
Started GET "/digital_assets?digital_asset_id=id-foobar-permanent-4" for 127.0.0.1 at 2014-02-07 13:23:08 -0700
|
9115
|
+
Processing by DigitalAssetsController#index as JSON
|
9116
|
+
Parameters: {"digital_asset_id"=>"id-foobar-permanent-4"}
|
9117
|
+
Completed 200 OK in 21.0ms (Views: 17.0ms)
|
9118
|
+
Started GET "/digital_assets?path=%2Fsome%2Fother%2Fpath.pdf" for 127.0.0.1 at 2014-02-07 13:23:09 -0700
|
9119
|
+
Processing by DigitalAssetsController#index as JSON
|
9120
|
+
Parameters: {"path"=>"/some/other/path.pdf"}
|
9121
|
+
Completed 200 OK in 21.0ms (Views: 16.0ms)
|
9122
|
+
Started GET "/digital_assets?digital_asset_id=id-foobar-permanent-6" for 127.0.0.1 at 2014-02-07 13:23:09 -0700
|
9123
|
+
Processing by DigitalAssetsController#index as JSON
|
9124
|
+
Parameters: {"digital_asset_id"=>"id-foobar-permanent-6"}
|
9125
|
+
Completed 200 OK in 22.0ms (Views: 18.0ms)
|
9126
|
+
Started GET "/digital_assets?published=2014-02-07+18%3A23%3A09+UTC" for 127.0.0.1 at 2014-02-07 13:23:09 -0700
|
9127
|
+
Processing by DigitalAssetsController#index as JSON
|
9128
|
+
Parameters: {"published"=>"2014-02-07 18:23:09 UTC"}
|
9129
|
+
Completed 200 OK in 45.0ms (Views: 13.0ms)
|
9130
|
+
Started GET "/digital_assets/foo-bar-id" for 127.0.0.1 at 2014-02-07 13:23:09 -0700
|
9131
|
+
Processing by DigitalAssetsController#show as JSON
|
9132
|
+
Parameters: {"id"=>"foo-bar-id"}
|
9133
|
+
Completed 200 OK in 36.0ms (Views: 14.0ms)
|
9134
|
+
Started GET "/digital_assets/not-found-doc" for 127.0.0.1 at 2014-02-07 13:23:09 -0700
|
9135
|
+
Processing by DigitalAssetsController#show as JSON
|
9136
|
+
Parameters: {"id"=>"not-found-doc"}
|
9137
|
+
Completed 404 Not Found in 77.0ms (Views: 1.0ms)
|
9138
|
+
Started PUT "/digital_assets/foo-bar-digital-asset-id" for 127.0.0.1 at 2014-02-07 13:23:09 -0700
|
9139
|
+
Processing by DigitalAssetsController#update as JSON
|
9140
|
+
Parameters: {"digital_asset"=>{"audiences"=>["investor"], "omniture_codes"=>["KOW2MY24D"], "orderable"=>"false", "pages"=>"1", "fund_codes"=>["00200", "00190", "00210"], "_id"=>"foo-bar-digital-asset-id", "title"=>"another title", "changed_at"=>"2014-02-05 20:23:08 UTC", "digital_asset_id"=>"foo-bar-digital-asset-id", "published_at"=>"2014-01-28 20:23:08 UTC", "expires_at"=>"2014-04-07 20:23:08 UTC", "sami_code"=>"IL1111.077", "business_owner"=>"biz owner", "path"=>"/9/foo/bar.txt", "finra_path"=>"/path/finradoc/10/foo/bar.txt", "legacy_path"=>"/oldpath/10/foo/bar.txt", "doc_changed_at"=>"2014-02-05 20:23:08 UTC", "content_type"=>"fact_sheet", "updated_at"=>"2014-02-07 20:23:09 UTC", "created_at"=>"2014-02-07 20:23:09 UTC"}, "id"=>"foo-bar-digital-asset-id"}
|
9141
|
+
Completed 200 OK in 26.0ms
|
9142
|
+
Started POST "/digital_assets" for 127.0.0.1 at 2014-02-07 13:23:09 -0700
|
9143
|
+
Processing by DigitalAssetsController#create as JSON
|
9144
|
+
Parameters: {"digital_asset"=>{"audiences"=>["investor"], "omniture_codes"=>["KOW2MY24D"], "orderable"=>"false", "pages"=>"1", "fund_codes"=>["00200", "00190", "00210"], "_id"=>"52f540adbed4234422280059", "title"=>"Doc Title", "changed_at"=>"2014-02-05 20:23:08 UTC", "digital_asset_id"=>"new-digital-asset-id", "published_at"=>"2014-01-28 20:23:08 UTC", "expires_at"=>"2014-04-07 20:23:08 UTC", "sami_code"=>"IL1111.077", "business_owner"=>"biz owner", "path"=>"/10/foo/bar.txt", "finra_path"=>"/path/finradoc/11/foo/bar.txt", "legacy_path"=>"/oldpath/11/foo/bar.txt", "doc_changed_at"=>"2014-02-05 20:23:08 UTC", "content_type"=>"fact_sheet"}}
|
9145
|
+
Completed 201 Created in 62.0ms
|
9146
|
+
Started DELETE "/digital_assets/foo-bar-digital-asset-id" for 127.0.0.1 at 2014-02-07 13:23:09 -0700
|
9147
|
+
Processing by DigitalAssetsController#destroy as JSON
|
9148
|
+
Parameters: {"id"=>"foo-bar-digital-asset-id"}
|
9149
|
+
Completed 200 OK in 8.0ms
|
9150
|
+
Started POST "/digital_assets/updated_time" for 127.0.0.1 at 2014-02-07 13:23:09 -0700
|
9151
|
+
Processing by DigitalAssetsController#updated_time as JSON
|
9152
|
+
Parameters: {"ids"=>["id-1", "id-2", "id-3", "id-4"]}
|
9153
|
+
Completed 200 OK in 27.0ms (Views: 1.0ms)
|
9154
|
+
Processing by DigitalAssetsController#index as HTML
|
9155
|
+
Completed 406 Not Acceptable in 1.0ms
|
9156
|
+
Processing by DigitalAssetsController#show as HTML
|
9157
|
+
Parameters: {"id"=>"id-foobar-permanent-9"}
|
9158
|
+
Completed 406 Not Acceptable in 5.0ms
|
9159
|
+
Processing by DigitalAssetsController#show as HTML
|
9160
|
+
Parameters: {"id"=>"IL1111.077"}
|
9161
|
+
Completed 406 Not Acceptable in 4.0ms
|
9162
|
+
Processing by DigitalAssetsController#show as HTML
|
9163
|
+
Parameters: {"id"=>"IL1111.077"}
|
9164
|
+
Completed 406 Not Acceptable in 4.0ms
|
9165
|
+
Processing by DigitalAssetsController#show as HTML
|
9166
|
+
Parameters: {"id"=>"id-foobar-permanent-13"}
|
9167
|
+
Completed 406 Not Acceptable in 4.0ms
|
9168
|
+
Processing by DigitalAssetsController#search as HTML
|
9169
|
+
Completed 406 Not Acceptable in 1.0ms
|
9170
|
+
Processing by DigitalAssetsController#search as HTML
|
9171
|
+
Parameters: {"path"=>"/one/off.path"}
|
9172
|
+
Completed 406 Not Acceptable in 2.0ms
|
9173
|
+
Processing by DigitalAssetsController#search as HTML
|
9174
|
+
Parameters: {"doctype"=>"fact_sheet"}
|
9175
|
+
Completed 406 Not Acceptable in 4.0ms
|
9176
|
+
Processing by DigitalAssetsController#search as HTML
|
9177
|
+
Parameters: {"doctype"=>["fact_sheet", "prospectus"]}
|
9178
|
+
Completed 406 Not Acceptable in 2.0ms
|
9179
|
+
Processing by DigitalAssetsController#search as HTML
|
9180
|
+
Parameters: {"sami"=>"SOMETHING.001"}
|
9181
|
+
Completed 406 Not Acceptable in 1.0ms
|
9182
|
+
Processing by DigitalAssetsController#search as HTML
|
9183
|
+
Parameters: {"audience"=>"492"}
|
9184
|
+
Completed 406 Not Acceptable in 1.0ms
|
9185
|
+
Processing by DigitalAssetsController#search as HTML
|
9186
|
+
Parameters: {"title"=>"Doc Title"}
|
9187
|
+
Completed 406 Not Acceptable in 1.0ms
|
9188
|
+
Processing by DigitalAssetsController#search as HTML
|
9189
|
+
Parameters: {"digital_asset_id"=>"id-foobar-permanent-35"}
|
9190
|
+
Completed 406 Not Acceptable in 1.0ms
|
9191
|
+
Processing by DigitalAssetsController#search as HTML
|
9192
|
+
Parameters: {"business_owner"=>"biz owner"}
|
9193
|
+
Completed 406 Not Acceptable in 1.0ms
|
9194
|
+
Processing by DigitalAssetsController#search as HTML
|
9195
|
+
Parameters: {"digital_asset_id"=>"id-foobar-permanent-42", "title"=>"Doc Title"}
|
9196
|
+
Completed 406 Not Acceptable in 4.0ms
|
9197
|
+
Processing by DigitalAssetsController#search as HTML
|
9198
|
+
Parameters: {"title"=>"Doc Title", "audiences"=>["investor"], "sami"=>"IL1111.077"}
|
9199
|
+
Completed 406 Not Acceptable in 2.0ms
|
9200
|
+
Processing by DigitalAssetsController#search as HTML
|
9201
|
+
Parameters: {"digital_asset_id"=>"blargh-blargh-blargh", "title"=>"Doc Title"}
|
9202
|
+
Completed 406 Not Acceptable in 1.0ms
|
data/spec/factories.rb
CHANGED
@@ -4,17 +4,37 @@ FactoryGirl.define do
|
|
4
4
|
title 'Doc Title'
|
5
5
|
changed_at 2.days.ago
|
6
6
|
audiences ['investor']
|
7
|
-
sequence(:digital_asset_id) {|n| "id-foobar-permanent-#{n}"}
|
7
|
+
sequence(:digital_asset_id) { |n| "id-foobar-permanent-#{n}" }
|
8
8
|
published_at 10.days.ago
|
9
9
|
expires_at 2.months.from_now
|
10
10
|
sami_code 'IL1111.077'
|
11
11
|
business_owner 'biz owner'
|
12
12
|
omniture_codes ["KOW2MY24D"]
|
13
|
-
sequence(:path) {|n| "/#{n}/foo/bar.txt"}
|
14
|
-
sequence(:finra_path) {|n| "/path/finradoc/#{n}/foo/bar.txt"}
|
15
|
-
sequence(:legacy_path) {|n| "/oldpath/#{n}/foo/bar.txt"}
|
16
|
-
doc_changed_at 2.days.ago
|
13
|
+
sequence(:path) { |n| "/#{n}/foo/bar.txt" }
|
14
|
+
sequence(:finra_path) { |n| "/path/finradoc/#{n}/foo/bar.txt" }
|
15
|
+
sequence(:legacy_path) { |n| "/oldpath/#{n}/foo/bar.txt" }
|
16
|
+
doc_changed_at 2.days.ago
|
17
17
|
content_type 'fact_sheet'
|
18
18
|
fund_codes ['00200', '00190', '00210']
|
19
19
|
end
|
20
|
+
|
21
|
+
factory :service_digital_asset do
|
22
|
+
title 'Doc Title'
|
23
|
+
changed_at 2.days.ago
|
24
|
+
audiences ['490']
|
25
|
+
sequence(:digital_asset_id) { |n| "id-foobar-permanent-#{n}" }
|
26
|
+
published_at 10.days.ago
|
27
|
+
expires_at 2.months.from_now
|
28
|
+
sami_code 'IL1111.077'
|
29
|
+
product_ids ['690', '420']
|
30
|
+
business_owner 'biz owner'
|
31
|
+
content_organization_ids ['LWXO44E8J', 'LWXO5XI3C']
|
32
|
+
program_ids ["LKZWOFHR6", "LKZWOFGF2"]
|
33
|
+
omniture_codes ["KOW2MY24D"]
|
34
|
+
sequence(:path) { |n| "/#{n}/foo/bar.txt" }
|
35
|
+
doc_changed_at 2.days.ago
|
36
|
+
content_type '666'
|
37
|
+
fund_codes []
|
38
|
+
display_on_website true
|
39
|
+
end
|
20
40
|
end
|
@@ -3,7 +3,8 @@ require 'spec_helper'
|
|
3
3
|
describe Daengine::DigitalAssetProcessor do
|
4
4
|
before { Daengine.configure(:assets_path => Dir.pwd+'/spec/mock_data',
|
5
5
|
:daengine_yml_file => Dir.pwd+'/spec/mock_data/daengine.yml',
|
6
|
-
:digital_assets_file_directory => Dir.pwd + '/spec/mock_data'
|
6
|
+
:digital_assets_file_directory => Dir.pwd + '/spec/mock_data',
|
7
|
+
:digital_asset_service_url => 'http://localhost:3000/digital_assets'
|
7
8
|
) }
|
8
9
|
context "process_tuple_directory" do
|
9
10
|
it 'processes only files modified in the last 2 days' do
|
@@ -12,9 +13,10 @@ describe Daengine::DigitalAssetProcessor do
|
|
12
13
|
DigitalAsset.count.should == 0
|
13
14
|
File.stub(:exist?) { true }
|
14
15
|
File.stub(:mtime) { Time.now }
|
15
|
-
|
16
|
+
Daengine::TeamsiteMetadataProcessor.should_receive(:process_tuple_file).any_number_of_times
|
17
|
+
#expect {
|
16
18
|
Daengine::DigitalAssetProcessor.process_tuple_directory
|
17
|
-
}.to change {DigitalAsset.count}.by_at_least(10)
|
19
|
+
#}.to change {DigitalAsset.count}.by_at_least(10)
|
18
20
|
end
|
19
21
|
it 'processes only those files that modified since the last time the daengine process ran' do
|
20
22
|
# process any files that has modified since last run. None !!
|
@@ -0,0 +1,236 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'daengine/teamsite_metadata_processor'
|
3
|
+
|
4
|
+
describe Daengine::TeamsiteMetadataProcessor do
|
5
|
+
before { Daengine.configure(:assets_path => Dir.pwd+'/spec/mock_data',
|
6
|
+
:daengine_yml_file => Dir.pwd+'/spec/mock_data/daengine.yml',
|
7
|
+
:digital_assets_file_directory => Dir.pwd + '/spec/mock_data/',
|
8
|
+
:digital_asset_service_url => 'http://localhost:3000/digital_assets')
|
9
|
+
}
|
10
|
+
subject { Daengine::TeamsiteMetadataProcessor }
|
11
|
+
|
12
|
+
context '#parse_file' do
|
13
|
+
it 'reads xml' do
|
14
|
+
file = File.expand_path('./spec/mock_data/selective_new_package.xml')
|
15
|
+
|
16
|
+
assets = subject.parse_file(open(file))
|
17
|
+
|
18
|
+
assets.count.should == 2 # hash with 2 keys
|
19
|
+
|
20
|
+
list = assets['163742d3-fbc2-4c99-8396-6eabe7464b8f']
|
21
|
+
entered = list.first
|
22
|
+
entered.digital_asset_id.should == '163742d3-fbc2-4c99-8396-6eabe7464b8f'
|
23
|
+
entered.path.should == '/digitalAssets/SSC_Developer_Installation_Guide-163742d3-fbc2-4c99-8396-6eabe7464b8f.doc'
|
24
|
+
entered.summary.should == 'first foo bar...'
|
25
|
+
#entered.title.should == 'fake title'
|
26
|
+
#entered.size.should == '12 kB'
|
27
|
+
#entered.pages.should == 1
|
28
|
+
#entered.finra_path.should == "/digitalAssets/TEST_FINRA_DOC.doc"
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'can read a whole bulk deploy xml file quickly' do
|
32
|
+
start = Time.now
|
33
|
+
file = File.expand_path('./spec/mock_data/bulk-ssc_deploy.xml')
|
34
|
+
assets = subject.parse_file(open(file))
|
35
|
+
(Time.now - start).should < 2.seconds
|
36
|
+
assets.count.should == 18
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context '#filter_assets' do
|
41
|
+
let(:asset) { FactoryGirl.build :service_digital_asset }
|
42
|
+
let(:other_asset) { FactoryGirl.build :service_digital_asset }
|
43
|
+
|
44
|
+
it 'should return assets that are effective' do
|
45
|
+
id = asset.digital_asset_id
|
46
|
+
assets = {id => [asset]}
|
47
|
+
|
48
|
+
results = subject.select_1_asset_per_id(assets)
|
49
|
+
|
50
|
+
results[id].should == asset
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should remove assets missing expires_at value' do
|
54
|
+
id = asset.digital_asset_id
|
55
|
+
asset.expires_at = nil
|
56
|
+
assets = {id => [asset]}
|
57
|
+
|
58
|
+
results = subject.select_1_asset_per_id(assets)
|
59
|
+
|
60
|
+
results[id].should be_nil
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should remove assets that are not displayed on the web site' do
|
64
|
+
id = asset.digital_asset_id
|
65
|
+
asset.display_on_website = false
|
66
|
+
assets = {id => [asset]}
|
67
|
+
|
68
|
+
results = subject.select_1_asset_per_id(assets)
|
69
|
+
|
70
|
+
results[id].should be_nil
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should return the non-expired asset' do
|
74
|
+
id = asset.digital_asset_id
|
75
|
+
other_asset.expires_at = 1.day.ago
|
76
|
+
|
77
|
+
assets = {id => [asset, other_asset]}
|
78
|
+
results = subject.select_1_asset_per_id(assets)
|
79
|
+
results[id].should == asset
|
80
|
+
|
81
|
+
# order in list shouldn't matter
|
82
|
+
assets = {id => [other_asset, asset]}
|
83
|
+
results = subject.select_1_asset_per_id(assets)
|
84
|
+
results[id].should == asset
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'should return the non-manifest asset' do
|
88
|
+
id = asset.digital_asset_id
|
89
|
+
other_asset.path = '/foo/manifest' + other_asset.path
|
90
|
+
|
91
|
+
assets = {id => [asset, other_asset]}
|
92
|
+
results = subject.select_1_asset_per_id(assets)
|
93
|
+
results[id].should == asset
|
94
|
+
|
95
|
+
# order in list shouldn't matter
|
96
|
+
assets = {id => [other_asset, asset]}
|
97
|
+
results = subject.select_1_asset_per_id(assets)
|
98
|
+
results[id].should == asset
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'should return the non-finra asset' do
|
102
|
+
id = asset.digital_asset_id
|
103
|
+
other_asset.content_type = DigitalAsset::ContentType::FINRA
|
104
|
+
|
105
|
+
assets = {id => [asset, other_asset]}
|
106
|
+
results = subject.select_1_asset_per_id(assets)
|
107
|
+
results[id].should == asset
|
108
|
+
|
109
|
+
# order in list shouldn't matter
|
110
|
+
assets = {id => [other_asset, asset]}
|
111
|
+
results = subject.select_1_asset_per_id(assets)
|
112
|
+
results[id].should == asset
|
113
|
+
end
|
114
|
+
|
115
|
+
it 'should set the finra_path on the returned asset' do
|
116
|
+
id = asset.digital_asset_id
|
117
|
+
other_asset.content_type = DigitalAsset::ContentType::FINRA
|
118
|
+
finra_path = other_asset.path
|
119
|
+
|
120
|
+
assets = {id => [asset, other_asset]}
|
121
|
+
results = subject.select_1_asset_per_id(assets)
|
122
|
+
result = results[id]
|
123
|
+
result.should == asset
|
124
|
+
result.finra_path.should == finra_path
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
context '#add_file_attributes' do
|
129
|
+
let(:asset) { FactoryGirl.build :service_digital_asset }
|
130
|
+
|
131
|
+
it 'should not set the file attributes for an asset that does not have an associated file' do
|
132
|
+
last_read = Time.now
|
133
|
+
path = '/foobar.pdf'
|
134
|
+
pages = -10
|
135
|
+
id = asset.digital_asset_id
|
136
|
+
asset.path = path
|
137
|
+
asset.pages = pages
|
138
|
+
assets = {id => asset}
|
139
|
+
|
140
|
+
asset.delete?.should == false
|
141
|
+
|
142
|
+
results = subject.add_file_attributes(assets, last_read)
|
143
|
+
|
144
|
+
result = results[id]
|
145
|
+
result.delete?.should == true
|
146
|
+
result.pages.should == pages
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'should set the file attributes based upon the digital asset file' do
|
150
|
+
last_read = 1.year.ago
|
151
|
+
path = '/digitalAssets/SSC_Developer_Installation_Guide-163742d3-fbc2-4c99-8396-6eabe7464b8f.doc'
|
152
|
+
id = asset.digital_asset_id
|
153
|
+
asset.path = path
|
154
|
+
assets = {id => asset}
|
155
|
+
|
156
|
+
results = subject.add_file_attributes(assets, last_read)
|
157
|
+
|
158
|
+
result = results[id]
|
159
|
+
result.path.should == '/digitalAssets/SSC_Developer_Installation_Guide-163742d3-fbc2-4c99-8396-6eabe7464b8f.doc'
|
160
|
+
result.size.should == '12 kB'
|
161
|
+
result.pages.should == 1
|
162
|
+
result.mime_type.should == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
|
163
|
+
#result.keywords.should == []
|
164
|
+
#result.subject.should be_nil
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
context '#add_fund_codes' do
|
169
|
+
let(:asset) { FactoryGirl.build :service_digital_asset }
|
170
|
+
|
171
|
+
it 'should add the fund code when found' do
|
172
|
+
id = asset.digital_asset_id
|
173
|
+
product_id = '666'
|
174
|
+
fund_code = '777'
|
175
|
+
asset.product_ids = [product_id]
|
176
|
+
assets = {id => asset}
|
177
|
+
DigitalAssetLookupService.should_receive(:fund_code_from_id).with(product_id).and_return(fund_code)
|
178
|
+
|
179
|
+
results = subject.add_fund_codes(assets)
|
180
|
+
|
181
|
+
result = results[id]
|
182
|
+
result_codes = result.fund_codes
|
183
|
+
result_codes.first.should == fund_code.rjust(5, '0')
|
184
|
+
end
|
185
|
+
|
186
|
+
it 'should not add nil if the fund code is not found' do
|
187
|
+
id = asset.digital_asset_id
|
188
|
+
product_id = '666'
|
189
|
+
fund_code = nil
|
190
|
+
asset.product_ids = [product_id]
|
191
|
+
assets = {id => asset}
|
192
|
+
DigitalAssetLookupService.should_receive(:fund_code_from_id).with(product_id).and_return(fund_code)
|
193
|
+
|
194
|
+
results = subject.add_fund_codes(assets)
|
195
|
+
|
196
|
+
result = results[id]
|
197
|
+
result_codes = result.fund_codes
|
198
|
+
result_codes.should == []
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
context '#call_service' do
|
203
|
+
let(:asset) { FactoryGirl.build :service_digital_asset }
|
204
|
+
let(:header) { {'Accept' => 'application/json',
|
205
|
+
'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
206
|
+
'User-Agent' => 'Ruby' } }
|
207
|
+
#let(:header) { {'Content-Type' => 'application/json'} }
|
208
|
+
|
209
|
+
it 'should delete an asset that is flagged for deletion' do
|
210
|
+
asset.expires_at = 1.day.ago
|
211
|
+
assets = {asset.digital_asset_id => asset}
|
212
|
+
path = "http://localhost:3000/digital_assets/#{asset.digital_asset_id}"
|
213
|
+
options = {:method => :delete, :headers => header}
|
214
|
+
response = Object.new
|
215
|
+
response.should_receive(:success?).and_return(true)
|
216
|
+
response.should_receive(:success?).and_return(true)
|
217
|
+
Daengine::HTTP::Client.should_receive(:call).with(path, options).and_return(response)
|
218
|
+
|
219
|
+
results = subject.call_service(assets)
|
220
|
+
results[:deleted].should == 1
|
221
|
+
end
|
222
|
+
|
223
|
+
it 'should add an asset that is not flagged for deletion' do
|
224
|
+
assets = {asset.digital_asset_id => asset}
|
225
|
+
path = "http://localhost:3000/digital_assets"
|
226
|
+
options = {:method => :post, :query => asset.as_hash, :headers => header}
|
227
|
+
response = Object.new
|
228
|
+
response.should_receive(:success?).and_return(true)
|
229
|
+
response.should_receive(:success?).and_return(true)
|
230
|
+
Daengine::HTTP::Client.should_receive(:call).with(path, options).and_return(response)
|
231
|
+
|
232
|
+
results = subject.call_service(assets)
|
233
|
+
results[:updated].should == 1
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|