add a new fixture sequence that has parameters. NEXT: Uncomment UI, tests

pull/1026/head
Rick Carlino 2018-10-25 11:47:01 -05:00
parent bfa006cac8
commit 7846554e79
4 changed files with 52 additions and 6 deletions

View File

@ -59,9 +59,9 @@ FarmBot::Application.routes.draw do
# Make life easier on API users by not adding special rules for singular
# resources.
# Might be safe to remove now with the advent of TaggedResource.kind
get "/device/:id" => "devices#show", as: :get_device_redirect
patch "/device/:id" => "devices#update", as: :patch_device_redirect
put "/device/:id" => "devices#update", as: :put_device_redirect
get "/device/:id" => "devices#show", as: :get_device_redirect
patch "/device/:id" => "devices#update", as: :patch_device_redirect
put "/device/:id" => "devices#update", as: :put_device_redirect
delete "/api/fbos_config/:id" => "fbos_configs#destroy", as: "delete_fbos_config_redirect"
get "/api/fbos_config/:id" => "fbos_configs#show", as: "get_fbos_config_redirect"
@ -77,8 +77,8 @@ FarmBot::Application.routes.draw do
patch "/api/web_app_config/:id" => "web_app_configs#update", as: "patch_web_app_config_redirect"
put "/api/web_app_config/:id" => "web_app_configs#update", as: "put_web_app_config_redirect"
patch "/users/:id" => "users#update", as: :patch_users_redirect
put "/users/:id" => "users#update", as: :put_users_redirect
patch "/users/:id" => "users#update", as: :patch_users_redirect
put "/users/:id" => "users#update", as: :put_users_redirect
patch "/webcam_feed/:id" => "webcam_feeds#update", as: :patch_webcam_feed_redirect
put "/webcam_feed/:id" => "webcam_feeds#update", as: :put_webcam_feed_redirect

View File

@ -6,6 +6,7 @@ if Rails.env == "development"
ENV['MQTT_HOST'] = "blooper.io"
ENV['OS_UPDATE_SERVER'] = "http://non_legacy_update_url.com"
DeviceSerialNumber.destroy_all
Log.destroy_all
TokenIssuance.destroy_all
PinBinding.destroy_all
@ -30,6 +31,10 @@ if Rails.env == "development"
agreed_to_terms_at: Time.now)
u = User.last
u.update_attributes(device: Devices::Create.run!(user: u))
# === Parameterized Sequence stuff
json = JSON.parse(File.read("spec/lib/celery_script/ast_fixture5.json")).deep_symbolize_keys
Sequences::Create.run!(json, device: u.device)
# === Parameterized Sequence stuff
Log.transaction do
FactoryBot.create_list(:log, 35, device: u.device)
end

View File

@ -30,4 +30,4 @@
}
}
]
}
}

View File

@ -0,0 +1,41 @@
{
"kind": "sequence",
"name": "has parameters",
"args": {
"locals": {
"kind": "scope_declaration",
"args": {},
"body": [
{
"kind": "parameter_declaration",
"args": {
"label": "parent",
"data_type": "point"
}
}
]
}
},
"body": [
{
"kind": "move_absolute",
"args": {
"speed": 100,
"location": {
"kind": "identifier",
"args": {
"label": "parent"
}
},
"offset": {
"kind": "coordinate",
"args": {
"x": 0,
"y": 0,
"z": 0
}
}
}
}
]
}