WIP
parent
1a1e622115
commit
363b24be8f
|
@ -181,6 +181,7 @@ module CeleryScriptSettingsBag
|
||||||
node.invalidate!(NO_PIN_ID % [klass]) if (id == 0)
|
node.invalidate!(NO_PIN_ID % [klass]) if (id == 0)
|
||||||
bad_node = !klass.exists?(id)
|
bad_node = !klass.exists?(id)
|
||||||
node.invalidate!(BAD_PIN_ID % [klass, id]) if bad_node
|
node.invalidate!(BAD_PIN_ID % [klass, id]) if bad_node
|
||||||
|
# binding.pry if [BoxLed3, BoxLed4].includes(klass)
|
||||||
end
|
end
|
||||||
.node(:nothing, [])
|
.node(:nothing, [])
|
||||||
.node(:tool, [:tool_id])
|
.node(:tool, [:tool_id])
|
||||||
|
|
|
@ -63,12 +63,13 @@ describe Resources::PreProcessor do
|
||||||
|
|
||||||
it "handles semantic errors using step2" do
|
it "handles semantic errors using step2" do
|
||||||
Transport.current.connection.clear!
|
Transport.current.connection.clear!
|
||||||
x = Resources::Service.step2(action: "wrong_action",
|
dev = FactoryBot.create(:device)
|
||||||
device: FactoryBot.create(:device),
|
x = Resources::Service.step2(action: "wrong_action",
|
||||||
body: "wrong_body",
|
device: dev,
|
||||||
resource_id: 0,
|
body: "wrong_body",
|
||||||
resource: "wrong_resource",
|
resource_id: 0,
|
||||||
uuid: "wrong_uuid")
|
resource: "wrong_resource",
|
||||||
|
uuid: "wrong_uuid")
|
||||||
call_args = x.calls[:publish].last
|
call_args = x.calls[:publish].last
|
||||||
message = JSON.parse(call_args.first)
|
message = JSON.parse(call_args.first)
|
||||||
options = call_args.last
|
options = call_args.last
|
||||||
|
@ -78,6 +79,11 @@ describe Resources::PreProcessor do
|
||||||
message.dig("body").pluck("args").pluck("message")
|
message.dig("body").pluck("args").pluck("message")
|
||||||
errors = message.dig("body").pluck("args").pluck("message")
|
errors = message.dig("body").pluck("args").pluck("message")
|
||||||
expect(errors).to include("Action isn't an option")
|
expect(errors).to include("Action isn't an option")
|
||||||
|
segment = options.fetch(:routing_key).split(".")
|
||||||
|
expect(segment[0]).to eq("bot")
|
||||||
|
expect(segment[1]).to eq("device_#{devi.id}")
|
||||||
|
expect(segment[2]).to eq("from_api")
|
||||||
|
expect(segment[3]).to eq("wrong_uuid")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "processes resources" do
|
it "processes resources" do
|
||||||
|
|
Loading…
Reference in New Issue