+ test "update a job without failing script_version check" do
+ authorize_with :admin
+ put :update, {
+ id: jobs(:uses_nonexistent_script_version).uuid,
+ job: {
+ owner_uuid: users(:admin).uuid
+ }
+ }
+ assert_response :success
+ put :update, {
+ id: jobs(:uses_nonexistent_script_version).uuid,
+ job: {
+ owner_uuid: users(:active).uuid
+ }
+ }
+ assert_response :success
+ end
+
+ test "search jobs by uuid with >= query" do
+ authorize_with :active
+ get :index, {
+ filters: [['uuid', '>=', 'zzzzz-8i9sb-pshmckwoma9plh7']]
+ }
+ assert_response :success
+ found = assigns(:objects).collect(&:uuid)
+ assert_equal true, !!found.index('zzzzz-8i9sb-pshmckwoma9plh7')
+ assert_equal false, !!found.index('zzzzz-8i9sb-4cf0nhn6xte809j')
+ end
+
+ test "search jobs by uuid with <= query" do
+ authorize_with :active
+ get :index, {
+ filters: [['uuid', '<=', 'zzzzz-8i9sb-pshmckwoma9plh7']]
+ }
+ assert_response :success
+ found = assigns(:objects).collect(&:uuid)
+ assert_equal true, !!found.index('zzzzz-8i9sb-pshmckwoma9plh7')
+ assert_equal true, !!found.index('zzzzz-8i9sb-4cf0nhn6xte809j')
+ end
+
+ test "search jobs by uuid with >= and <= query" do
+ authorize_with :active
+ get :index, {
+ filters: [['uuid', '>=', 'zzzzz-8i9sb-pshmckwoma9plh7'],
+ ['uuid', '<=', 'zzzzz-8i9sb-pshmckwoma9plh7']]
+ }
+ assert_response :success
+ found = assigns(:objects).collect(&:uuid)
+ assert_equal found, ['zzzzz-8i9sb-pshmckwoma9plh7']
+ end
+
+ test "search jobs by uuid with < query" do
+ authorize_with :active
+ get :index, {
+ filters: [['uuid', '<', 'zzzzz-8i9sb-pshmckwoma9plh7']]
+ }
+ assert_response :success
+ found = assigns(:objects).collect(&:uuid)
+ assert_equal false, !!found.index('zzzzz-8i9sb-pshmckwoma9plh7')
+ assert_equal true, !!found.index('zzzzz-8i9sb-4cf0nhn6xte809j')
+ end
+
+ test "search jobs by uuid with like query" do
+ authorize_with :active
+ get :index, {
+ filters: [['uuid', 'like', '%hmckwoma9pl%']]
+ }
+ assert_response :success
+ found = assigns(:objects).collect(&:uuid)
+ assert_equal found, ['zzzzz-8i9sb-pshmckwoma9plh7']
+ end
+
+ test "search jobs by uuid with 'in' query" do
+ authorize_with :active
+ get :index, {
+ filters: [['uuid', 'in', ['zzzzz-8i9sb-4cf0nhn6xte809j',
+ 'zzzzz-8i9sb-pshmckwoma9plh7']]]
+ }
+ assert_response :success
+ found = assigns(:objects).collect(&:uuid)
+ assert_equal found.sort, ['zzzzz-8i9sb-4cf0nhn6xte809j',
+ 'zzzzz-8i9sb-pshmckwoma9plh7']
+ end
+
+ test "search jobs by started_at with < query" do
+ authorize_with :active
+ get :index, {
+ filters: [['started_at', '<', Time.now.to_s]]
+ }
+ assert_response :success
+ found = assigns(:objects).collect(&:uuid)
+ assert_equal true, !!found.index('zzzzz-8i9sb-pshmckwoma9plh7')
+ end
+
+ test "search jobs by started_at with > query" do
+ authorize_with :active
+ get :index, {
+ filters: [['started_at', '>', Time.now.to_s]]
+ }
+ assert_response :success
+ assert_equal 0, assigns(:objects).count
+ end
+
+ test "search jobs by started_at with >= query on metric date" do
+ authorize_with :active
+ get :index, {
+ filters: [['started_at', '>=', '2014-01-01']]
+ }
+ assert_response :success
+ found = assigns(:objects).collect(&:uuid)
+ assert_equal true, !!found.index('zzzzz-8i9sb-pshmckwoma9plh7')
+ end
+
+ test "search jobs by started_at with >= query on metric date and time" do
+ authorize_with :active
+ get :index, {
+ filters: [['started_at', '>=', '2014-01-01 01:23:45']]
+ }
+ assert_response :success
+ found = assigns(:objects).collect(&:uuid)
+ assert_equal true, !!found.index('zzzzz-8i9sb-pshmckwoma9plh7')
+ end
+
+ test "search jobs with 'any' operator" do
+ authorize_with :active
+ get :index, {
+ where: { any: ['contains', 'pshmckw'] }
+ }
+ assert_response :success
+ found = assigns(:objects).collect(&:uuid)
+ assert_equal 0, found.index('zzzzz-8i9sb-pshmckwoma9plh7')
+ assert_equal 1, found.count
+ end
+
+ test "search jobs by nonexistent column with < query" do
+ authorize_with :active
+ get :index, {
+ filters: [['is_borked', '<', 'fizzbuzz']]
+ }
+ assert_response 422
+ end
+
+