Commit Graph

310 Commits

Author SHA1 Message Date
Benjamin Porter fb2eaf982a Outcomes - add calculation_method and calculation_int API access
Add API access to get/set the calculation_method and calculation_int on
learning outcome objects.  Add some default values for these, and
handling for older learning outcomes that have a nil calculation_method
and calculation_int.  Also add some specs.

Fixes CNVS-10619

Test Plan:

    (Verify this all works when authorized, and all fails when
    unauthorized)

    Using the API:
        context: create a new outcome
            - create a new outcome group and an outcome
            - query for the group and outcome and make sure they return properly
            - observe that the default calculation_method is returned as 'decaying_average'
            - observe that the default calculation_int is returned as 75

        context: query an existing outcome
            - query an existing outcome (should have a nil
              calculation_method in the DB)
            - observe that the API returns 'highest' for the
              calculation_method

        context: update an outcome
            - make an update to an existing learning outcome, adding
              a calculation_method of 'highest'.
            - re-query, verifying correct info returned
            - verify that a calculation_int is NOT returned
            - make another update to the outcome, this time setting
              calculation_method to 'n_mastery' or 'decaying_average'.
              Set calculation_int to '8' or '85', respectively
            - re-query, verifying correct info returned. Verify that
              a calculation_int IS returned

Change-Id: If07b0f6a85a8a080b6e96cadc1f5b3745b71794f
Reviewed-on: https://gerrit.instructure.com/45399
Reviewed-by: Matt Berns <mberns@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Benjamin Porter <bporter@instructure.com>
2015-01-07 18:11:28 +00:00
Simon Williams 174298e8ea add sis_term_id support to term api
closes CNVS-17710

test plan:
- as an admin with permission to manage sis, make sure sis ids are
  returned in the terms api
- try creating a new term with an sis id, it should work
- try updaing and existing term with an sis id, it should work
- updating without specifying an sis_term_id should not remove the id
- updating and specifying sis_term_id: '' should remove it

Change-Id: Ia91766d6ee04b360432de1a603d89d1e6ba89c8b
Reviewed-on: https://gerrit.instructure.com/46438
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
2015-01-02 19:43:01 +00:00
Brian Palmer fdc5210c95 redis wrapper for twemproxy compat
refs CNVS-17062

This wrapper will catch any usage of the redis commands that twemproxy
doesn't support, including in specs, so that they don't sneak through.

test plan: specs should still pass, and redis caching should continue to
work as before.

Change-Id: I88d74c23c92c8be9f49e9399d8acbaf8ba31513e
Reviewed-on: https://gerrit.instructure.com/44710
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2014-12-29 21:37:42 +00:00
Cameron Matheson 5cda45c40f add grade period support to grade calculator
closes CNVS-17105

Test plan:
  (This has to be done at the rails console)

  * enable multiple grading periods
  * set up assignments in all the grading periods
  * grade the assignments for a student
  * run the grade calculator for a grade period.  make sure the grade
    only considers assignments in the grading period:

    gc = GradeCalculator.new([student_id], course, grading_period)
    pp gc.compute_scores.first.first

Change-Id: I3b87eb7ec08fedebaab4f7a2fc83e68d4d4d5c7e
Reviewed-on: https://gerrit.instructure.com/45753
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2014-12-29 20:01:45 +00:00
Spencer Olson ec302728fa course grading periods should not return an error
add content and tests for API to ensure that the
course's grading period is RESTful.

test plan:

1. In a course, turn on the multiple grading periods feature flag
2. Using the api, create a few grading periods
3. do a GET on api/v1/courses/:course_id/grading_periods
4. verify that you don't get an error

fixes CNVS-17492

Change-Id: I36cdd1fea1bdd9b426d061e29abb75dd6a192a80
Reviewed-on: https://gerrit.instructure.com/45748
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
2014-12-18 01:13:36 +00:00
James Williams 4baea5aa6b add not null column restraint to enrollments role_id
Change-Id: I167620165171b6fd0d41e69590e1f3225ac2fe2c
Reviewed-on: https://gerrit.instructure.com/45690
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-12-15 21:00:57 +00:00
James Williams 2c69f3966b remove non-draft-state everything
test plan:
* basic regression test on assignments, discussion topics
 gradebook, and modules (mostly make sure the basic
 index/show/edit views aren't broken)

closes #CNVS-15563

Change-Id: I3411bfb7645b3c4bf8a4663e3e052b4402f899ba
Reviewed-on: https://gerrit.instructure.com/43609
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
2014-12-10 17:57:18 +00:00
Bracken Mosbacker d378436b59 add lti variable subs for section ids
Now an LTI launch can list the section ids that a user has
enrollments in with: $Canvas.course.sectionIds and
$Canvas.course.sectionSisSourceIds

Test Plan:
 * Create a user with enrollments in a section and multiple sections
 * Configure an LTI tool to have the 2 new section variable subs
 * The ids/sis ids of the section that the user has a direct
   enrollment in should be substituted
 * If a teacher is only enrolled in the main section all the other ones
   will _not_ be listed.

closes PLAT-784

Change-Id: I0af6b674a710767f4f38693f86fac8b988a21f06
Reviewed-on: https://gerrit.instructure.com/45462
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2014-12-10 17:34:04 +00:00
Ahmad Amireh 1bb148ae61 QLA - QuestionAnswered
Support for extracting and recording "question_answered" events from
submission_data. Unlike the other event patches, this takes place
completely on the back-end.

Closes CNVS-16802

Other things:

  - refactored stuff to use QuizSubmission#graded?
  - QuizQuestion::AnswerSerializers now output string IDs

TEST PLAN
---- ----

You need a database browser for this, like pgadmin3 [1].

Preparation:

  - create a quiz with ALL question types
  - using pgadmin3, view the data in the quiz_submission_events_2014_XX
    table (XX would be the current month), keep this window open
    + this window should be empty so far, unless you're repeating this
      plan

  - go to take quiz page
  - do anything useful to trigger the initial backup call:
    + verify that there's a new record with "event_type" is
      "question_answered"
    + grab the "event_data" in that column and paste it in some JSON
      editor like http://jsoneditoronline.org/ [2]
    + verify that this data-set includes the initial answers for ALL
      questions

Ok, now we need to test whether each answer we update gets recorded:

  - in any question, change your answer
  - open the pgadmin3 table window
    + refresh, press F5
    + verify there's a new event record
    + copy/paste the "event_data" in the JSON editor and:
      - verify that not ALL the answers were recorded again, ONLY the
        one that you have just added/changed/updated

Rinse and repeat with the rest of the questions. Make sure that answers
to *all* question types are being recorded (this includes File Upload,
in which case the value would be the attachment ID.)

[1] pgadmin3 works on all platforms, download it for OS X from
    http://www.pgadmin.org/download/macosx.php
[2] when copying from pgadmin3, it may wrap the JSON with '' and that
    will cause an error in the editor, just remove those quotes

Change-Id: I3330bd987396aa84937af295390ec169b06c58e9
Reviewed-on: https://gerrit.instructure.com/44335
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-11-21 02:57:46 +00:00
Spencer Olson 9cde815d68 add grading period group model
add GradingPeriodGroup, and change associations between GradingPeriods,
GradingPeriodGroups, Courses, and Accounts. also adjust the grading
periods controller to account for addition of grading period groups

closes CNVS-16538

test plan:
-run bundle exec rake db:migrate, and bundle exec rake db:migrate RAILS_ENV=test
-verify the migrations successfully run
-open the rails console in sandbox: bundle exec rails c -s
-create a course, a few grading periods, and a grading period group. Add the grading periods to the group. Assign
  the grading period group to the course.
  $ course = Course.create
  $ grading_period1 = GradingPeriod.create(weight: 25.0, start_date: Time.zone.now, end_date: 2.days.from_now)
  $ grading_period2 = GradingPeriod.create(weight: 30.0, start_date: Time.zone.now, end_date: 2.days.from_now)
  $ grading_period_group = GradingPeriodGroup.create()
  $ grading_period_group.grading_periods << grading_period1
  $ grading_period_group.grading_periods << grading_period2
  $ grading_period_group.course = course
-verify the associations are working as expected, i.e. a GradingPeriodGroup has GradingPeriods, a GradingPeriod
  belongs to a GradingPeriodGroup, and a GradingPeriodGroup belongs to a course or account.
  $ grading_period_group.grading_periods #should return an array containing grading_period1 and grading_period2
  $ grading_period1.grading_period_group #should return grading_period_group
  $ grading_period2.grading_period_group #should return grading_period_group
  $ grading_period_group.course #should return course
  $ grading_period_group.account #should return nil (should not throw error)

Change-Id: I9d7465431dabd2afa18e7a8a33706b9a78a94cd1
Reviewed-on: https://gerrit.instructure.com/43512
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
2014-11-14 22:07:00 +00:00
James Williams 9945043150 fix role overrides fetching for site admin on a separate shard
test plan:
* have site admin on one shard
* make a custom account role
* give it all the permissions
* login as a user with that custom role
* visit an account on another shard
* should have all the permissions

Change-Id: I2a128a672b7b6973e1d25c58d635f0147a486240
Reviewed-on: https://gerrit.instructure.com/44353
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-11-13 19:09:51 +00:00
Jon Jensen 5e82318681 spec: don't run content migration specs twice
also speed up large_courses specs (3:26 -> 0:26)

Change-Id: Ie2447b14d1829851762d1cd133adaaaeafe97a04
Reviewed-on: https://gerrit.instructure.com/44316
Reviewed-by: Hannah Bottalla <hannah@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2014-11-12 16:32:01 +00:00
James Williams 7372523690 refactor role type definitions to fix circular dependencies
Change-Id: I7cca4a22ef7dc310ba1b94fd81d67854a6fe1daf
Reviewed-on: https://gerrit.instructure.com/43833
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-11-12 15:29:33 +00:00
Ahmad Amireh cb498b345f canvas-partman & quiz log auditing partitioning
A small gem for abstracting partitioning at the model layer, as well as
helpers for dynamically creating the partitions needed for quiz
submission events.

You can read more about the gem's API in its README file.

Closes CNVS-16795

TEST PLAN
---- ----

  - check out the patch
  - run `bundle exec rake db:migrate`
  - run `bundle exec rake canvas:quizzes:create_event_partitions`
  - run the rails server and visit any page:
    + if you got this far, and jenkins has passed, things are good

Change-Id: I7d6b77c62db8510e09a54fbae00048a14b5366bb
Reviewed-on: https://gerrit.instructure.com/44145
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-11-11 19:06:00 +00:00
James Williams 81d4adc319 new roles
refactor everything that used to use strings for roles
to use actual role_ids

the apis should be backwards compatible so we don't need
to update (most of) the UI's right away in this commit

test plan:
* regression tests for permissions, role overrides,
 alerts (for account roles), enrolling users,
 adding account admins, etc.

refs #CNVS-15481

Change-Id: Id57fd3104c5c518b6fbf180609950dcddcdd474d
Reviewed-on: https://gerrit.instructure.com/41208
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-10-31 19:44:14 +00:00
Simon Williams 4fffb25087 force tests to run with draft state on
Change-Id: If7dbcd29ddbb0f5912fc0fc819017533f44a5ad7
Reviewed-on: https://gerrit.instructure.com/42229
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2014-10-29 19:18:01 +00:00
Cody Cutrer 27dbafc6cc rails 3 always marshal cache writes
so we don't need to force marshalling in tests

Change-Id: Ia12f0ed55281f5691a304e6e82bf796cb0da39a0
Reviewed-on: https://gerrit.instructure.com/43233
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-10-27 19:20:55 +00:00
Brian Palmer f6900880bf extract delayed_job plugin into separate gem
closes CNVS-15881

This mostly involved adding hooks to the gem for things that we were
directly modifying in Canvas, then hooking into those points in the
canvas config/initializers/delayed_job.rb file.

Periodic jobs scheduling changed a bit as well -- there's no longer
support in the extracted gem for reading a special file under config/,
so I moved our periodic_jobs.rb file to a normal initializer.

test plan: delayed jobs should still work as before, including queuing
jobs, running the worker pool, and in tests.

Change-Id: I9ce57091d18f21f4355011fcb75230193d53facb
Reviewed-on: https://gerrit.instructure.com/42027
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2014-10-24 20:46:00 +00:00
Cody Cutrer be44418405 upgrade to rspec 3
fix a blocking thing, and add a compatibility gem

and a few final missed things

fixes CNVS-16239

Change-Id: I6ffa4569f936173393eaf7225f7463a4ccba1c7c
Reviewed-on: https://gerrit.instructure.com/42715
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <braden@instructure.com>
Product-Review: Braden Anderson <braden@instructure.com>
QA-Review: Braden Anderson <braden@instructure.com>
2014-10-17 18:39:43 +00:00
Shawn Meredith ef8cb57bc8 spec: rspec3ify bullet pending
Change-Id: If8fc87f778cc4883d4abadcdcf173a74da64e6cd
Reviewed-on: https://gerrit.instructure.com/42897
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-10-17 14:52:31 +00:00
Cody Cutrer 0651f7e4e4 rspec 3-ify spec_helper
refs CNVS-16239

Change-Id: I60538bd7bc190ae32c527500d85ecdd5360f35f4
Reviewed-on: https://gerrit.instructure.com/42869
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <braden@instructure.com>
Product-Review: Braden Anderson <braden@instructure.com>
QA-Review: Braden Anderson <braden@instructure.com>
2014-10-16 23:13:23 +00:00
Cody Cutrer e16ff48b23 raise errors on rspec deprecations
refs CNVS-16239

Change-Id: Ica174a75bbc621e77578457ab6ff7627fd4f8cfb
Reviewed-on: https://gerrit.instructure.com/42714
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-10-16 16:16:03 +00:00
Cody Cutrer dacf060160 no more dynamic finders
fixes CNVS-15126

Change-Id: I48b99ff69942463df6d6c355fe6f8a2fc679e69a
Reviewed-on: https://gerrit.instructure.com/41969
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-10-03 16:22:49 +00:00
Ethan Vizitei c4765bc2a0 gemify broadcast policy
fixes #CNVS-14270

move broadcast policy into a gem of its own
to remove plugin deprecation warnings.

TEST PLAN:
 -no behavior changes
 -regression test notifications
   (no need to hit them all, confirm that 3 or
   4 separate notifications flow and
    that will prove the pipeline)

Change-Id: If8445653ec09ab4d221124d85f9674d1cedd3751
Reviewed-on: https://gerrit.instructure.com/40899
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Matthew Wheeler <mwheeler@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
QA-Review: August Thornton <august@instructure.com>
2014-09-24 11:35:33 +00:00
Brian Palmer 2eb1b4db7c rails4: gemify attachment_fu
closes CNVS-14268

Since this is very clearly our own fork of the gem at this point, I've
removed a lot of unused code, rather than fixing it up to work as a gem.
This includes:

* all the other processors besides mini_magick
  * red_artisan, it was only used by the core_image processor
  * geometry and the Array monkey patch, it was only used by image science
* the db_file_backend
* the Tempfile monkey patch, I fixed the AttachmentFu code to properly
  create tempfiles with the desired extension
* removed the Technoweenie outer namespace, to match normal gem practices

test plan:

Attachments should still work as before, including viewing, uploading,
downloading, and thumbnail generation.

Change-Id: I94ff63182af839ec54b64714defd6912b0d91f65
Reviewed-on: https://gerrit.instructure.com/41281
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2014-09-18 22:28:54 +00:00
Liz Abinante 6960995489 DA - notifications for assignments
fixes CNVS-13933

test plan (with a course setup for DA):

for the following tests:
* perform them on assignments that are only_visible_to_overrides
* _and_ again on assignments that should be visible to everyone (regression)

- mute an existing assignment that has a due date for one section only
- unmute it
- verify that the *unmuted* notification only go to the students & admins who can see the assignment

notes: must be an existing assignment that is more than 30 minutes old

Change-Id: Ic26fe29a8b1db06e376fdeae129636b0a097fab1
Reviewed-on: https://gerrit.instructure.com/37271
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Liz Abinante <labinante@instructure.com>
2014-09-08 21:52:28 +00:00
Cody Cutrer 061d60899e configurize possible postgres extensions
Change-Id: I57bf7eebf4a9f5a828dffb3d4b689b6cac9aa0f0
Reviewed-on: https://gerrit.instructure.com/40197
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-08-28 22:02:22 +00:00
Brian Palmer 181579660c clear shard and special account caches based on age
test plan:

- regression test to make sure that you can navigate to different
  domains and shards, create + process delayed jobs, and navigate to the
  default and site admin accounts

Change-Id: I0ed4bf3309e3950a046ed1cd7bc7b1fe0a806a7a
Reviewed-on: https://gerrit.instructure.com/39972
Tested-by: Brian Palmer <brianp@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2014-08-26 20:29:55 +00:00
Brad Horrocks 279fa22ddb Fixes Profile avatar on thumbnail no longer showing correct image
Thumbnails will now have namespace column which will be populated with
its attachments namespace on save. Old thumbnails will have null
namespace and should behave as they used to. New thumbnails will work
like boss.

Fixes CNV-12380

Test Plan
=========

Prerequisites
-------------

- S3 storage
- **Sharding**
	- multiple users with the same ID on different shards
	- profile photos on all the users with the same fileID

Details
-------

Before the fix the last uploaded avatar will be the *thumbnail* for
all user avatars that collide with each other.
After the code is updated all avatars will be blank.
After `bundle exec rake db:migrate` avatars should display correctly.

Change-Id: Iec533086308da352f317cda60b404327b14516e3
Reviewed-on: https://gerrit.instructure.com/39108
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
2014-08-22 22:17:51 +00:00
Brian Palmer b55992e8ac gemify respondus_soap_endpoint
This turns the vendor/plugin into a rails engine, and establishes the
convention of canvas-dependent rails engines/gems going into
gems/plugins, and everything in that dir being auto-required and added
to canvas spec runs.

closes CNVS-14286

test plan: regression test on the respondus quiz builder client. no
behavior should change.

Change-Id: I51b548418bcb70af77e87c2c2d62cac27ed4ab44
Reviewed-on: https://gerrit.instructure.com/38394
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2014-08-21 16:49:54 +00:00
Paul Hinze 1bd1f9e236 spec: silence rspec deprecation warning
full warning:

> rspec-rails 3 will no longer automatically infer an example group's spec type
> from the file location. You can explicitly opt-in to this feature using this
> snippet:
>
> RSpec.configure do |config|
>   config.infer_spec_type_from_file_location!
> end
>
> If you wish to manually label spec types via metadata you can safely ignore
> this warning and continue upgrading to RSpec 3 without addressing it.

Change-Id: I0f0ec385a49d6b37bfb236c82ab1027934476441
Reviewed-on: https://gerrit.instructure.com/39299
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Paul Hinze <paulh@instructure.com>
QA-Review: Paul Hinze <paulh@instructure.com>
2014-08-14 16:56:11 +00:00
James Williams 81558f728c remove rails 2 support
closes #CNVS-14261

Change-Id: I1b0e8a4438ab659ecd1ac8462bc3559d810989b3
Reviewed-on: https://gerrit.instructure.com/38744
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-08-06 18:16:19 +00:00
Jon Jensen ae7a5fb84c spec: once-ler spec/controllers/[d-e]*
reduce runtime ~50% (2:16 -> 1:06)

Change-Id: I7fae1628f8d9f726bcd0ac6b94f170682e0a9394
Reviewed-on: https://gerrit.instructure.com/38666
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2014-08-04 16:18:14 +00:00
Jon Jensen eef510c920 spec: stub test translations
fixes sporadic i18n failures (due to unexpected translations persisting
across tests)

Change-Id: Id7f4f13d8d789797b60c5492e5d37ae8e6aae34e
Reviewed-on: https://gerrit.instructure.com/38606
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
2014-08-01 23:42:26 +00:00
Jon Jensen 88578b84a7 spec: speed up spec/controllers/[a-c]*
in rails3, reduce runtime ~45% (8:10 -> 4:25 locally)

Change-Id: Ia3d17b99f1d80d5cc344ff7286244eb551a6c6b1
Reviewed-on: https://gerrit.instructure.com/38417
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2014-07-31 16:09:14 +00:00
Jon Jensen 5480c8fecd spec: speed up api specs
liberal applicataion of once-ler and bulk_insert helpers, reduce runtime
from 50min -> 25min

Change-Id: I07c1952c4ead0a1c6caafc389de0b9586b27dc68
Reviewed-on: https://gerrit.instructure.com/37794
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2014-07-29 16:11:16 +00:00
dave 7e6519d586 add api endpoint to post global annoucement
***test plan
  1.  Make a POST like /accounts/1/account_notifications
  2.  Required Parameters:
      1) account_notification[subject]
      2) account_notification[start_at]
      3) account_notification[end_at]
      4) account_notification[message]
  3.  Optional Parameters:
      1) account_notification[icon]
        'warning' | 'information' | 'question' | 'error' | 'calendar'
         note: defaults to warning
      2) account_notification_roles[]
        'StudentEnrollment', 'TeacherEnrollment' etc...
        this defaults to all roles
  4.  Only account admins should be able to make the api call
  5.  Should not be able to create an account notification with an
  end_at < start_at

closes:  PS-1730
closes: PS-1872

Change-Id: Ide86722598ae4a7ab565422f2996015b48cf8910
Reviewed-on: https://gerrit.instructure.com/37477
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Brandon Broschinsky <brandonbr@instructure.com>
2014-07-25 22:16:18 +00:00
James Williams 6cd29088be spec: re-fix base_transactions for onceler
Change-Id: I22ea36859637e6081d79b5c3f1ec064a778635ca
Reviewed-on: https://gerrit.instructure.com/38028
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-07-23 16:20:15 +00:00
Jon Jensen 4872ee008e spec: once-ler spec/models/[r-w]*
in rails3, reduce runtime >50% (8:23 -> 4:04 locally)

Change-Id: Ie5a81e2088a4fe579f3ce1d04345743ccd46458a
Reviewed-on: https://gerrit.instructure.com/37311
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2014-07-14 19:39:17 +00:00
Jon Jensen b5ac86752d spec: once-ler, now with sharding support
revisit some already once-ler'd specs, reduce runtime of modified files
by ~20% (5:20 -> 4:10 locally)

Change-Id: I60ee5cb1cd1491d8c3c9acc2a7d990303529cb96
Reviewed-on: https://gerrit.instructure.com/37607
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2014-07-14 16:09:27 +00:00
Cameron Sutter 0f5c76f422 reset cached access tokens in api specs
this allows once-ler to work in api specs by
resetting the user access tokens cache in the
global before :each block

Change-Id: I580007a17129e3e4b96f6310113e1578b5e63544
Reviewed-on: https://gerrit.instructure.com/37553
Reviewed-by: Brian Palmer <brianp@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-07-11 17:06:28 +00:00
Jacob Fugal d9c6e2a0cd clarify Slug vs. UUID and fix event stream
refs CNVS-13987

what was called CanvasUuid was *not* generating UUIDs. it was generating
slugs. by default, its generate method only creates 4 character slugs.
these should obviously not be used as UUIDs. the misnomer already caused
a bug in EventStream where it used these slugs as UUIDs, causing
collisions. to fix:

 (1) rename canvas_uuid gem to canvas_slug, and rename it's primary
     class CanvasUuid to CanvasSlug
 (2) create new canvas_uuid gem, with class CanvasUUID, extracted from
     lib/uuid_singleton for actual UUID generation
 (3) fix event stream use CanvasUUID, rather than following the rename
     of CanvasUuid to CanvasSlug

test-plan:
 - have cassandra set up for audit logs
 - create an audit log entry (e.g. change a grade)
 - look at the generated audit log entry's id field; it should be a UUID
   value, not a 4 character slug

Change-Id: I19758fff4433cd6cb2e21219217dced19ee05c5a
Reviewed-on: https://gerrit.instructure.com/37506
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2014-07-11 16:58:42 +00:00
Cody Cutrer 2d69296ab1 fix some rspec deprecation warnings
Change-Id: Ibcaf3116888d364e9e291bbc91816ec21f90e1ff
Reviewed-on: https://gerrit.instructure.com/37405
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-07-09 14:36:17 +00:00
Simon Williams cdba3f2f09 force draft state on
this hard-codes draft state to on in the code, but still allows tests to run
against non-draft state code (as if it was still set to allowed).  this allows
us to then go clean up tests on a component by component basis as we rip out
old non draft state code

closes CNVS-13582

test plan:
- basic canvas regression test
- make sure draft state is on for all courses
- make sure it cannot be turned off at the course or account level

Change-Id: Ia22e6b8a7e40a64b42021846f2fe85aaf3005504
Reviewed-on: https://gerrit.instructure.com/37260
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
2014-07-07 17:13:40 +00:00
Nick Cloward 4ec9c8f90a enable colors for rails 3 rspec
Change-Id: I92afbb4182ee3133e0d634ad816a23b4729f5f2c
Reviewed-on: https://gerrit.instructure.com/37228
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2014-07-03 21:51:46 +00:00
Jon Jensen f42af73427 spec: basic once-ler integration, speed up some specs
see https://github.com/instructure/once-ler

in rails3, reduce spec/models/a* runtime by ~45% (15min -> 8.5min locally)

Change-Id: Ia7bbc36c3602c3c3742c1b894e539584323f3e14
Reviewed-on: https://gerrit.instructure.com/37043
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Dave Donahue <ddonahue@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2014-07-01 02:59:23 +00:00
Cody Cutrer c3b0df2474 restrict admins from creating or deleting more powerful admins
fixes CNVS-13351

test plan:
 * created an admin role that has permission to create other admins,
   but that's it
 * as an admin in that role, it should only show that role as one
   to choose for new admins
 * you should only be able to delete admins in that role
 * verify both of the above are enforced via the API

Change-Id: I11459567ab184d787ee02af55280e0f4f76d47e8
Reviewed-on: https://gerrit.instructure.com/35672
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-06-30 20:58:26 +00:00
Cody Cutrer 53160dfd4d use an unreleased mocha on ruby 2.1
Change-Id: I3bb3a6e51fc5f76d5fc31a1c894e83ea5d5b22ec
Reviewed-on: https://gerrit.instructure.com/36737
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-06-24 19:39:23 +00:00
Nick Cloward e690395a9c increase permissions performance
fixes: CNVS-11425

This is a performance refactor of the permissions.  The
biggest change is the caching.  The cache key is now based
on the right so each right will be cached by itself.  The
goal is to reduce places where we implement caching for
permissions and let adheres_to_policy handle it.

Another commit is coming to clean up calls to the new
methods created here.  g/34280

Test Plan:
  - Make sure permissions all work still.
  - Make masquerading still works with permissions.
  - Make sure switing views such as "student view" for a
    course.

Change-Id: I4a30b0aba394cea24c3b60167fc1369a2584f5a4
Reviewed-on: https://gerrit.instructure.com/34278
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-06-18 22:27:39 +00:00
Brian Palmer b2dbb1c868 spec: don't truncate cassandra in tests
Turns out that truncate is a super slow operation in Cassandra. For the
tests that this affects, we'll handle the potentially non-empty db.

Change-Id: Ie7e64add3b53f26eb98ba441e46270a8c08657ea
Reviewed-on: https://gerrit.instructure.com/36593
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Shawn Meredith <shawn@instructure.com>
QA-Review: Shawn Meredith <shawn@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-06-18 20:13:21 +00:00