Commit Graph

587 Commits

Author SHA1 Message Date
Landon Wilkins ef4149106a spec: add logging for simplecov starts
Change-Id: I79536048444489a30e7348c2a3a389345a303907
Reviewed-on: https://gerrit.instructure.com/88449
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2016-08-22 22:12:33 +00:00
Jon Jensen aeb4c655ec spec: remove unused helpers
also fix GC regression around create_temp_dir!

Change-Id: Ibe60fb9cd7d5a455d7e3643e3d5f68ca0ad9a96e
Reviewed-on: https://gerrit.instructure.com/88441
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
2016-08-22 21:39:02 +00:00
Jon Jensen 9179e3fff5 spec: simplify setup/cleanup logic, refs SD-1422
* ensure appropriate things are set up before recording and each spec
* remove various unused cleanup-y things
* make BlankSlateProtection.disable restore the previous state

one plugin still needs some massaging around transactions/etc., then we
can turn on BlankSlateProtection and force transactional tests across the
board

Change-Id: I9aacda0f80f94af4dff3ac30c65b5ccd22e7d47d
Reviewed-on: https://gerrit.instructure.com/88397
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
2016-08-22 20:55:52 +00:00
Jon Jensen 6045f92a3a spec: tighten up blank slate protection some more
refs SD-1419

also make a tweak to facilitate multiple test processes sharing a db

Change-Id: I1f429538213463b2a025c561523a0c0c782aa8e5
Reviewed-on: https://gerrit.instructure.com/87861
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
2016-08-16 18:20:53 +00:00
Landon Wilkins 78ee569ba6 require_relative for coverage_tool
our CI now performs some loading magic that
breaks the regular require

test plan:
* verify no explosions for:
  COVERAGE=1 bundle exec rspec ./spec/models/user_spec.rb

Change-Id: Ie6c095ce114ae28eeca2d65850fcb1fbc254a450
Reviewed-on: https://gerrit.instructure.com/87698
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins
2016-08-12 20:38:18 +00:00
Jon Jensen c2bd6be6a6 spec: fix BlankSlateProtection issue
make sure vanilla canvas (no plugins) doesn't blow up when starting up the
thin server

Change-Id: I072a995af4e03bb38cb6edb2355b6fac00710a05
Reviewed-on: https://gerrit.instructure.com/87413
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
Tested-by: Jenkins
2016-08-10 19:58:00 +00:00
Jon Jensen 8c51f15448 spec: remove unused method
Change-Id: I2cda544c0d5c8054113d7b3c5f9f3f5089d99d65
Reviewed-on: https://gerrit.instructure.com/87279
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
Tested-by: Jenkins
2016-08-09 22:08:49 +00:00
Derek Bender c62274c4a6 add grading period set endpoints
- fix spec_helper require
 - the API for GradingPeriodController now only accepts
   requests with the correct mimetype of 'application/json'

refs: CNVS-27104

Once dev/grading-periods-update lands in master we
need to move the title presence validation from the
controller to the model.

test plan:
 - ensure that the new actions in GradingPeriodSetController
   are available via the API:
   - GET    /accounts/1/grading_period_sets
   - POST   /accounts/1/grading_period_sets
   - PATCH  /accounts/1/grading_period_sets/1
   - DELETE /accounts/1/grading_period_sets/1
 - the json data for POST/PATCH looks something like:

    {
      "grading_period_set": {
        "title": "A Grading Period Set Title"
      },
      "enrollment_term_ids": ["1"]
    }

 - only users with permissions to the root account may
   create GradingPeriodGroups attached to an EnrollmentTerm.
 - if a user on a sub account is supplied, the api will
   return unauthorized.

Change-Id: I0aa555fbd8d0b803fa7e97a1989de57b9eaf52fe
Reviewed-on: https://gerrit.instructure.com/78078
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-06-01 13:39:33 +00:00
Landon Wilkins 0cc14da2cd turn on Timecop safe_mode, fixes SD-1019
test plan:
* specs pass

Change-Id: Ib2be7276f15880de73228ed4a3ce7047bca8678b
Reviewed-on: https://gerrit.instructure.com/78742
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
2016-05-16 18:59:40 +00:00
James Williams 8efaeeb3a4 spec: cleanup temp directories afterwards
Change-Id: I31d9c548faed196a970a3f24e1b251a87b08127b
Reviewed-on: https://gerrit.instructure.com/78451
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-05-03 12:46:59 +00:00
Nathan Mills 28fa95ef9e fix problems with lti2 and assignments
fixes PLAT-1371

test plan:

create an LTI 2 assignment
it should launch

create and LTI 2 assignment that is a module item
it should launch

Change-Id: I9cb77477a5d8eec7742c90e5a3c501fc9b6cdce6
Reviewed-on: https://gerrit.instructure.com/76300
Tested-by: Jenkins
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2016-04-25 20:22:36 +00:00
Rob Orton d236166297 drop mysql support and gem
test plan
 - specs should pass

Change-Id: Ib3f102b53d947198625e3118820d22e77a005dd6
Reviewed-on: https://gerrit.instructure.com/77249
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2016-04-19 19:55:55 +00:00
Jon Jensen fc46b69121 selinimum 3: autoload magic, fixes SD-1018
Make most autoloadable files selinimizable. That means that you can edit
most models/helpers/gems/lib files and only have the relevant selenium
specs run \o/

How does it work?
=================

As with the existing selinimized stuff (controllers/views/css/js/etc), we
capture the dependencies of each spec file in a post-merge build. To
accomplish this, we hook into Rails' autoloading mechanism and give it
some hide/restore magic. This way we can hide all autoloaded constants
from one spec file to the next (technically, top-level example group).
As specs run, constants are loaded (or restored) via autoloading, and
we track all of them.

Then on your patchset build, we synthesize this information with the list
of files you changed. If all files are selinimizable, we can safely run
just a subset of specs.

What things are still not selinimizable?
========================================

* config/* (including routes.rb)
* models loaded when the app starts up (~20%, biggies like User, etc.)
* observers and their models (cuz they really like to load :allthethings:)
* things that are `require`d (`require_dependency` is a-ok though)

Test Plan:
* Normal patchset builds should pass
* Build with capturing enabled should pass and publish to S3
* Test commits based on this one should:
  1. Be correctly selinimized if limited to captured autoloads, etc.
  2. Not be selinimized otherwise

[selinimum-capture]

Change-Id: I04cea1fa6055d201d72d210a3e9bd770f26769a5
Reviewed-on: https://gerrit.instructure.com/76931
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
2016-04-16 17:00:29 +00:00
Jon Jensen 66ac9ba1c7 spec: ensure example groups don't leave garbage behind
since this adds some overhead, it's opt-in. currently passes on master, and
will be turned on for post-merge builds (but not patchsets)

Change-Id: I645fcf56f4bc7ca5fdf401e4c6cb58547f3d71d8
Reviewed-on: https://gerrit.instructure.com/73781
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
2016-03-29 22:19:04 +00:00
Cody Cutrer b469b83f64 protect against inadvertent use of potentially dangerous redis commands
test plan:
 * try Rails.cache.instance_variable_get(:@data).keys, or any other way
   you can think of to try and get all keys (or flushdb or other scary
   stuff) from redis
 * it should raise an error
 * Shackles.activate!(:deploy)
 * try again
 * it should work

Change-Id: I57772df3851fd14b6a46a56c9cd8ef6ddce015e3
Reviewed-on: https://gerrit.instructure.com/73940
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2016-03-15 15:02:07 +00:00
Cody Cutrer ecf89e25c7 spec: don't form invalid SQL when no tables exist
Change-Id: I3400418bc98efd5208a6cd06539f3d4cb0ccb66e
Reviewed-on: https://gerrit.instructure.com/74160
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-03-10 23:28:08 +00:00
James Williams 0777cba946 remove differentiated assignments feature checks
test plan:
* basic regression test of assignment overrides

closes #CNVS-27549

Change-Id: Ie463848b3831087efb3f9ec762dca6264055ee76
Reviewed-on: https://gerrit.instructure.com/73139
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-03-07 18:44:46 +00:00
Ethan Vizitei 2999576bdc RCE resiliant to consul failure
closes CNVS-27666

this stops us from getting a page error in cases
where consul is suddenly gone and we don't have a
cached value for a CDN endpoint.

Users will get an error in their js console,
and the textarea will display with no editor chrome.

TEST PLAN:
 1) point your consul.yml to a fake host
 2) with the feature flag for RCE on, go to eportfolios
    and try to edit one
 3) you should still be able to play with the form, even though
    you won't have an editor

Change-Id: Ia5a1e4b9e243e2c10cdc12726a26f6a0eb2e0d1f
Reviewed-on: https://gerrit.instructure.com/73545
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2016-03-04 18:48:34 +00:00
Jon Jensen 8dc7dc31a5 spec: make sure we reset each shard before specs (if we have shards)
but make sure we have default roles everywhere. this will allow us to use
schema snapshots (w/ no data) for all the shards in CI-land

refs SD-857

Change-Id: I7f1ca2253af86f71a9bef243b6bb51f94a927aef
Reviewed-on: https://gerrit.instructure.com/73143
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2016-02-26 18:48:40 +00:00
Cody Cutrer e201a09959 spec: fix broken transactions from preventing error reporting
this is only necessary in test, when we have the fixture transaction

also adjust our detection of "real" transaction in test

Change-Id: I81960f62f9656d709face95cf1288c397d0f5773
Reviewed-on: https://gerrit.instructure.com/72161
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-02-23 18:08:17 +00:00
Amber Taniuchi ebee51a079 spec: add spec to a11y focus on gradebook menus
fixes CNVS-27176
refs CNVS-25752
refs CNVS-25664

Test Plan:
- pass Jenkins
- check for syntax errors
- make sure new test_ids match up to an existing test case in TestRails

Change-Id: I81fc21054e6cde546efba8a06734a2141af29ebb
Reviewed-on: https://gerrit.instructure.com/71893
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Product-Review: Caleb Guanzon <cguanzon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
2016-02-19 21:47:35 +00:00
Cody Cutrer a5fb414d20 spec: fix table truncation for qualified names
refs CNVS-26480

when the search path is empty, pg_depend won't give you the table name,
so extensions tables won't be excluded. so join on oid instead

Change-Id: I1d98104fc6504a80c98a6f3a7adf84751065158f
Reviewed-on: https://gerrit.instructure.com/71951
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-02-11 18:08:29 +00:00
Ethan Vizitei ad75b72c28 make canvas pull secrets from consul, not env vars
closes CNVS-26734

distributing env vars through production is harder
than updating a shared highly available store.  We put this stuff
in consul now so it's easy to update everywhere at once.

also clean up webmock spec usage, it causes a lot of errors
because it's configuration seeps outside the specs it's currently used
in

TEST PLAN:
  1) no production changes (does not touch app code)
  2) clean install, clean config directory
  3) copy docker-compose/config/ files to your config directory
  4) you shouldn't be missing any config files when you start your
     compose file up
  5) Canvas::DynamicSettings.find("canvas") should give you a hash
      with your secrets from the init values in your config file
  6) ServicesJwt.signing_secret and ServicesJwt.encryption secret
      should pull those same values
  7) if you have env vars for ECOSYSTEM_KEY or ECOSYSTEM_SECRET, they
      should be ignored

Change-Id: I3b3c1b19d6e2a05af3e6caa2e0af6c5d1dc6df66
Reviewed-on: https://gerrit.instructure.com/71559
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
2016-02-11 00:01:48 +00:00
Shawn Meredith c11d4d15b1 spec: coverage tool tweaking for test-queue
Change-Id: I694839ec7467d64fb306a3de70b49676d32a8e9b
Reviewed-on: https://gerrit.instructure.com/69606
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2016-01-28 18:16:16 +00:00
Jon Jensen 693641626e spec: randomize spec run order
this should make it easier to get past ordering issues during the rerun
phase and retriggers. conversely, this will also expose more flaky tests
lurking in the suite, so we can fix them

test plan:
1. specs should pass
2. it should still say "Randomize with seed N"
3. it should actually be randomized

Change-Id: Ie109ec79290aa32727d8027ca0ae9cb3e07ce8ef
Reviewed-on: https://gerrit.instructure.com/70891
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2016-01-25 23:01:21 +00:00
Cody Cutrer 7cb9bc2494 spec: no longer depend on test-unit
we don't use its helper anymore

also relax bundler requirement, since no gems require asking for
platform ruby_23 anymore

Change-Id: Ia4cb9466363325f7d006307d4487df3b2269eaa3
Reviewed-on: https://gerrit.instructure.com/70100
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-01-12 18:01:23 +00:00
Cody Cutrer fc94cf07d0 spec: avoid test-unit html assertions
in ruby 2+, the newer test-unit gem raises on assertion failure,
meaning that negated assertions will raise, instead of checking
for failure and then succeeding.

Instead, user newer rspec syntax, and nokogiri

Change-Id: I83570ba0115a15ec4624c2b4565e4e9441674af8
Reviewed-on: https://gerrit.instructure.com/70037
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-01-12 16:51:32 +00:00
Jon Jensen e2eb88098c spec: fix signal trapping in selenium specs, remove cruft
now you can Ctrl-C to stop selenium, specs \o/

remove unused error handling logic, shuffle some stuff

Change-Id: I50c3dc093242d41b9764d33e50b06bc8daef1c07
Reviewed-on: https://gerrit.instructure.com/69758
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2016-01-06 23:15:01 +00:00
Derek Bender 7edcc213a2 spec: 🕘 💣 use relative dates for grading periods
This fixes a problem where the hard coded values in this spec
would eventually overlap with the relatively coded grading period
factories. This patchset uses relative values that are outside
of the factories.

Change-Id: Id916790c0c65b33d30c01514f9ec6b2bc5e62128
Reviewed-on: https://gerrit.instructure.com/69657
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
2016-01-05 03:59:20 +00:00
James Williams 71190f85fc rails 4.2: fix spec initialization
refs #CNVS-26056

Change-Id: I4819bbadd2ad20d573b172ce402329d7445107ce
Reviewed-on: https://gerrit.instructure.com/69523
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-12-30 17:25:19 +00:00
James Williams d2833299d7 remove rails 3 support
also add initial rails 4.2 scaffold

refs #CNVS-25988

Change-Id: Ifd7aecaffb6cfc8a3e41bc3fb011fb6ce0664ea6
Reviewed-on: https://gerrit.instructure.com/69129
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-12-23 21:36:43 +00:00
Jon Jensen 56b526f518 spec: logging/server enhancements, refs SD-692
* make sure the thin server is up and fully functional
* log every request (even if denied by SeleniumDriverSetup.disallow_requests!)
* use a different log file for each worker (done in suite hook for test-
  queue compatibility, since it forks)

Change-Id: I5d4a264a32cac322bbfa48c8558716d9d6357130
Reviewed-on: https://gerrit.instructure.com/68819
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2015-12-17 17:37:09 +00:00
Jon Jensen 31b36c5385 spec: isolate plugin settings better in specs
fixes brittle ./spec/lib/app_center/app_api_spec.rb:112 and possibly
others. if #current_account is meaningful and gets set in one spec, make
sure it doesn't affect subsequent specs (in particular ones that use
caching)

Change-Id: I2b54fcf8e941a8d3a50c367f0f1d8e18d018d00b
Reviewed-on: https://gerrit.instructure.com/68784
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2015-12-11 21:24:08 +00:00
Jon Jensen 2ffa2075f5 spec: disallow record creation outside spec lifecycle
fixes various brittle specs

Change-Id: Ia595df0865efb3cdfcdd73d62adba9c40cf6f737
Reviewed-on: https://gerrit.instructure.com/68684
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2015-12-11 16:36:00 +00:00
Cody Cutrer ced66d4c41 spec: output a decent backtrace when an after context block fails
Change-Id: If9924685d13198fd0cc1ce5b2613a30359bdbb52
Reviewed-on: https://gerrit.instructure.com/63272
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-11-30 17:04:48 +00:00
Brad Horrocks ff5dd90527 Capture better errors for failed grade passback
This adds oauth info to captured error exceptions

Fixes PLAT-1256

Test Plan:
The error report should include all of the OAuth1 header information
If the Authorization Header is not OAuth1 it should not include it
The error report should also include the signature canvas generates
The error report should include where the authorization failed. i.e.
signature, nonce, expiration

The best way to test this is run the test :D
The best way to manually test this:
- Setup an LTI Tool (I used the example tool with all the checkboxes
  checked)
- Use post man stand alone
- create a new request to "/api/lti/v1/tools/<tool_id>/grade_passback"
- Use post man's Authorization tab to setup OAuth1
- Use the tools key and secret
- tweak settings for different failure tests
- select add params to header
- click update request
- send the request

You will need to manually change the auth header to get to some
failures. Let me know if you need help

Change-Id: If09882017eaae0ddff96d39b7f33c2da9c1a7fc8
Reviewed-on: https://gerrit.instructure.com/65944
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brad Horrocks <bhorrocks@instructure.com>
2015-11-05 22:49:16 +00:00
kinezu b858cba8ca Taking appium mobile specs out of the canvas-lms project
They now live in their own private repository.

Change-Id: Id4e9e3f745c1311fc75f99bb62333af44b90f145
Reviewed-on: https://gerrit.instructure.com/66125
Tested-by: Jenkins
Reviewed-by: Taylor Wilson <twilson@instructure.com>
Product-Review: Derek Hansen <dhansen@instructure.com>
QA-Review: Derek Hansen <dhansen@instructure.com>
2015-11-05 16:33:55 +00:00
Cameron Matheson 934972294e fix jenkins when selenium webdriver crashes
fixes CNVS-23356

test plan:
* retrigger this until we get an EOFError
* subsequent specs should still pass, as should the rerun of the EOFError

Change-Id: Id549457691b2107a3f3882ce5b6ce45711fed395
Reviewed-on: https://gerrit.instructure.com/64402
Reviewed-by: Cameron Matheson <cameron@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
2015-11-04 19:46:01 +00:00
Cody Cutrer 4070cbde22 fix finding tables for spec truncation
refs CNVS-23621

Change-Id: I19218b4453d772f20e22767564622e131387e918
Reviewed-on: https://gerrit.instructure.com/65662
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-10-22 20:53:03 +00:00
Simon Williams 5b9497d77a re-include session_id in logs
Rack generates a session_id internally which we like to include in logs
for tracking requests. This session_id wasn't getting picked up by out
log wrapper because of interdependencies in the middleware call stack
and bugs in rack/rails. Read on for details:

See the order of the middleware stack by running: `rake middleware`

The main players in this saga are:
- RequestContextGenerate middleware
- session store middleware:
    ActionDispatch::Session::EncryptedCookieStore <
    ActionDispatch::Session::CookieStore <
    Rack::Session::Cookie <
    Rack::Session::Abstract::ID
- Rack::Session::Abstract::SessionHash

How to intercept the session_id:

The Rack session_id is generated lazily the first time the SessionHash
(which is a thin wrapper around a ruby hash) is read from or written to.
This needs to happen after the session has been loaded out of the cookie
by the session store middleware, which happens after our
RequestContextGenerate middleware.  We don't just want to move the
generation of the request id later, because then the first couple log
lines will not tagged with a request id.

So our idea was to capture the session_id in an un-encrypted cookie that
could be read early in the middleware call stack (which is fine to be
public, and only used for logs to not a big deal if it's tampered with).
Again, this happens lazily on first access, so our best bet is to catch
it on the way out of the middleware stack.  But when
RequestContextGenerator returns it's already too late, because cookies
have already been written to the header.  So we introduce a new
middleware that captures the session_id, writes it to a cookie, and then
modify RequestContextGenerator to read from the cookie.

This works great except that with this setup, after a log in attempt the
redirect after login would still be logged with the old "unknown"
session_id and not the new, logged-in session_id.  When a session is
cleared (what happens at log in time), ActionDispatch implements
a `reset_session` that we call, which calls session.destroy, but rack
had not implemented session.destroy, so rails patched it, but then after
calling destroy, they reset the session to a plain hash (not
a SessionHash), so an id isn't generated until the plain-hash session is
written to the cookie, which happens AFTER our new middleware finishes
in the stack (and never sets it in the place we look for it).

Rails 4:

Rack internals changed somewhat between rack-1.4 and rack-1.5 and the id
moves from being stored in the session options hash to the main session
hash.  We'll need to fix this for rails 4.

A better way:

It may be better to try to keep a handle on the actual SessionHash so
that we can dynamically load the id for log lines, and pick up id
changes immediately as they happen, mid-request. We'd have to make sure
the lookups weren't too expensive though, vs just saving a string.

fixes CNVS-15259

Test plan:
- start a server, make a request
- you should see log lines start with [session_id, request_id] and
  session_id should be present, not just "-"

Change-Id: I0289db255b2b0bc3b118e32fc1d0d9381455b1ec
Reviewed-on: https://gerrit.instructure.com/64092
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-10-02 19:33:50 +00:00
Brad Horrocks 18e5369ef7 DRY Up LTI Tool links
We can now use context_external_tools_helper to update lti links inside
erbs

Fixes PLAT-1242

Test Plan:
Add an LTI tool using [this
xml](https://gist.github.com/defektive/dbd182cb04500e236bde) or use
[this
url](4a7939ccb4/canvas_icon_class-lti_test.xml)

check the following cog menus for functioning LTI links
- assignments
- quizzes
- modules
- discussions

Check the following right side menus for functioning LTI links
- Course Home
- Course Settings

Change-Id: I75f6cf7c5b3e73b25f8bd6c20404e7379bc46ce6
Reviewed-on: https://gerrit.instructure.com/63620
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brad Horrocks <bhorrocks@instructure.com>
2015-09-29 17:46:22 +00:00
Brad Horrocks a11fdec9f6 Make LTI configurations accept canvas icon class
Support passing a class for an icon for styling goodness.

added support for `canvas_icon_class` allowing use od css classes from canvas
style guide which can make it look better and maintain our styling
standards.

Fixes PLAT-1222

Test Plan:

prereq's
- "LOR External Tools" feature flag enabled
- (notice the lack of lti example tool, you dont need it)

A new commons icon has been added so you should probably run the
following
`bundle exec rake brand_configs:clean canvas:compile_assets`

Add a new LTI tool to the account using [this xml](https://gist.github.com/defektive/dbd182cb04500e236bde)
check placements to make sure they show a fancy new icon instead of a
crappy star. course_home_sub_navigation should show up as the commons icon

placements to look at
:assignment_menu - cog on an assignment
:course_home_sub_navigation - right side of page
:course_settings_sub_navigation
:discussion_topic_menu
:file_menu (no icon)
:global_navigation (no icon)
:module_menu
:quiz_menu
:wiki_page_menu

Change-Id: Ib462e928a5a3811df490f9bf2441b755db2882a9
Reviewed-on: https://gerrit.instructure.com/62492
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brad Horrocks <bhorrocks@instructure.com>
2015-09-21 17:59:40 +00:00
James Williams 9f8d53d40f don't truncate schema_migrations in tests
Change-Id: If60f87ce1e5e07a68a9ab8c615e0e24be8c12a46
Reviewed-on: https://gerrit.instructure.com/62004
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-08-28 14:27:23 +00:00
Taylor Wilson 4db4923846 Appium setup modified to truncate developer_keys table
- Mobile verify expects developer_keys to have a
    specific index. This resets the sequence value to 101.

  - To test: run specs, query test database, and verify
    developer_key has sequence value of 101.

Change-Id: If00c387edc67c3f00a1e1ee6043546a7d2cc1577
Reviewed-on: https://gerrit.instructure.com/60373
Tested-by: Jenkins
Reviewed-by: Heath Hales <hhales@instructure.com>
Reviewed-by: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Ben Bolton <bbolton@instructure.com>
QA-Review: Ben Bolton <bbolton@instructure.com>
2015-08-10 20:46:31 +00:00
Cody Cutrer 00d63fecfd rails4/ruby2.2: explicitly require test-unit
Change-Id: Ia9be2e8063eb4ab088ca6b8afc949d3e375f5240
Reviewed-on: https://gerrit.instructure.com/59874
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-08-06 14:15:17 +00:00
James Williams b5c012f370 rails4: silence deprecation warnings in tests
make sure to remove this once we're on rails 4

refs #CNVS-21596

Change-Id: I1b6ddef79ab2bae44a81e3e53112725b9c229aff
Reviewed-on: https://gerrit.instructure.com/59737
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-08-03 16:30:08 +00:00
James Williams f9cb24c3df rails4: fix time equality expectations in specs
refs #CNVS-21596

Change-Id: I341418b7387ca8c09d1248466bd24d088495d1a6
Reviewed-on: https://gerrit.instructure.com/59615
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-08-03 16:29:54 +00:00
James Williams 600165e7b2 rails4: deprecate Relation#all in favor of Relation#to_a
refs #CNVS-21596

Change-Id: I5dedaab90a2abe6bf288ff30401c9b31629b45b2
Reviewed-on: https://gerrit.instructure.com/59220
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-07-24 21:28:14 +00:00
James Williams 5f9304f3e0 rails4: various api spec fixes
refs #CNVS-21596

Change-Id: Ib41c03782b1667d3876283fd99d8ccf7585e1fd6
Reviewed-on: https://gerrit.instructure.com/58651
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-07-21 15:44:32 +00:00
James Williams daef59589d rails4: fix view specs
rails4 removed the automatic initialization of a local variable
matching the name of a partial view
 (e.g. setting `course` to nil in _course.html.erb)

also helper methods are protected so they cannot simply be
delegated to the spec controller anymore

refs #CNVS-21596

Change-Id: I7ce8b8a0084602a93f8ac571ee5c98740cb861d1
Reviewed-on: https://gerrit.instructure.com/58718
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-07-17 20:41:55 +00:00
Jon Jensen 4a83f6b6a2 selinimum: run the minimum selenium necessary for your commit
What is this?
=============

Selinimum speeds up selenium by only running the specs it needs to for
your commit (iff it can safely determine that). For the purposes of the
initial implementation, that means that if your commit ONLY affects:

1. controllers (but not ApplicationController)
2. views (but not shared / layouts)
3. misc whitelisted stuff (images, .md files, etc.)

then it will only run the selenium specs that actually exercise those.
If your commit touches ANYTHING else (models, lib, etc.), all selenium
specs will run.

But wait, there's more!
=======================

Very soon selinimum will also handle:

1. js/coffee/jsx/hbs (except in the common bundle)
2. scss (except in the common bundle)

We already capture which bundles get used by each spec (see Capture), we
just need to correlate that with the individual files via a dependency
graph (probably using madge and sass-graph)

How does it work?
=================

The new post-merge selenium build will run all the specs with selinimum
capturing enabled. This records any controllers/views/js_bundle/css_bundle
that gets used in the course of each selenium spec, and stores a bunch of
data in S3.

Then when your patchset build runs, it will run Selinimum.minimize (via
corresponding tweak in rspect repo) on the list of spec files. If your
commit's dependents can be fully inferred and synthesized with the spec
dependency data from S3, only the relevant specs will actually be run.

Test Plan
=========

This commit doesn't actually cause selinimum to run on jenkins; that
requires some rspect changes and jenkins config. Refer to the test plan
here: https://gerrit.instructure.com/#/c/58088/

Change-Id: I991574c327a3a580c6fdc3ca3797dcfe0490a096
Reviewed-on: https://gerrit.instructure.com/58085
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2015-07-17 03:20:55 +00:00
John Corrigan fcb87dc336 move factories out of spec_helper
This is the first step to get us moved over to factory girl for test
factories. Gergich (rightly) has a lot to say on this, because I've
moved around a lot of scary looking code, but I am hesitant to spend
much time on fixing it here, since the end goal would be to rewrite most
all of the factory logic in factory girl anyway. Any feedback is good
feedback!

Change-Id: Id0da1099e98d4ac79c6bf1e1e8808d6e7ea43596
Reviewed-on: https://gerrit.instructure.com/57853
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: John Corrigan <jcorrigan@instructure.com>
Tested-by: John Corrigan <jcorrigan@instructure.com>
Product-Review: John Corrigan <jcorrigan@instructure.com>
2015-07-16 15:29:29 +00:00
Cody Cutrer fcd944d600 explicitly reference functions from extensions in their correct schema
fixes CNVS-21362

test plan:
 * make sure you have pg_collkey installed
 * test user search
 * it shouldn't asplode

Change-Id: I911d57ea950679b3e26390c140149c528eae0a2d
Reviewed-on: https://gerrit.instructure.com/56969
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2015-07-13 23:02:57 +00:00
Cameron Sutter 3196af04e4 Turn on DA for all accounts
closes CNVS-21601

test plan:
- Differentiated Assignments should be on for all courses in all accounts

Change-Id: I24142a2e8e20186c62de5ef8db909e13b87f44e6
Reviewed-on: https://gerrit.instructure.com/57502
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Cameron Sutter <csutter@instructure.com>
2015-07-08 19:04:40 +00:00
Rob Orton 12f4686244 spec make sure pseudonyms are created on root_accounts
refs CNVS-21700

test plan
 - specs should pass

Change-Id: I89570dbfe5162c83c9b9cfcdc2d73ee1e881dffa
Reviewed-on: https://gerrit.instructure.com/57709
Tested-by: Jenkins
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2015-07-03 21:25:50 +00:00
Derek Hansen a2ec00f281 Adding test id's to convo specs and a few other minor improvments
test plan:
- pass jenkins

Change-Id: I39f1a043b4a184047c6dcce4a4d3234e1dba403f
Reviewed-on: https://gerrit.instructure.com/56127
Tested-by: Jenkins
Reviewed-by: Ben Bolton <bbolton@instructure.com>
Product-Review: Derek Hansen <dhansen@instructure.com>
QA-Review: Derek Hansen <dhansen@instructure.com>
2015-06-26 15:44:36 +00:00
Deepeeca Soundarrajan f3921c3d1a Quiz -VDD - Quiz index and show page for various roles
The commit tests the index page and show page for a quiz with
    multiple due dates for various roles. The roles include student in
    the main section, student in the additional section, ta, and
    observer associated to student in the additional section.

    Observer associated to both the students in the main section and
    additional section is currently not working as expected(I think a
    bug has been already raised for this). The rest is working fine.

Change-Id: I7c5852b9692b29d4de5e36cb51cc0669e7d2b37a
Reviewed-on: https://gerrit.instructure.com/55391
Tested-by: Jenkins
Reviewed-by: Derek Hansen <dhansen@instructure.com>
Product-Review: Derek Hansen <dhansen@instructure.com>
QA-Review: Derek Hansen <dhansen@instructure.com>
2015-06-22 19:10:13 +00:00
Cody Cutrer 7881feab4b enforce valid saml entity id on login
fixes CNVS-21191

test plan:
 * configure saml, but without the entity id
 * logins should fail saying your IdP was unrecognized
 * fix the entity id
 * you should be able to log in

Change-Id: I8226bf5c831a4cc939477dd12e3dc8d95e55aa38
Reviewed-on: https://gerrit.instructure.com/55906
Tested-by: Jenkins
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2015-06-12 21:00:37 +00:00
Ethan Vizitei f7401feb8f Soft delete accont authorization configs
closes CNVS-20947

Allow users to "delete" auth configs without
violating foreign key constraints.
Also means updating all places that use the
association interface to a new method
that strips out inactive AACs

TEST PLAN:
 1) create a new AAC with the IDP of your choice
 2) create some pseudonyms that are attached to the new AAC
 3) try to delete the AAC from the authorization config area
 4) it should not blow up

Change-Id: Iff56fd8aa2ee66a2468191a9c880a99862d83927
Reviewed-on: https://gerrit.instructure.com/55808
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2015-06-12 20:10:28 +00:00
Cody Cutrer 4d256af1e0 bump ruby_parser for ruby 2.2 compatibility
Change-Id: I458439223d29fee1b4e4edb9ec30aac0cffa19e7
Reviewed-on: https://gerrit.instructure.com/56161
Tested-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-06-11 16:03:48 +00:00
Derek Bender 81feabdfbf validate grading period do not overlap dates
Grading Periods previously could overlap in arbitrary ways.
This adds a server side validation to ensure that when a Grading
Period is persisted it will not overlap with existing Grading
Periods in the same Grading Period Group. Grading Periods in
different groups are not validated in this way. The front end will
report errors if attempting to save a grading period that overlaps.

Our definition of overlapping is any two grading periods
intersecting each other except if the end date of an earlier
grading period is equal to the start date of a later grading period

These two grading periods would be considered overlapping
(when in the same group):

  GradingPeriod.new(
    start_date: 0.months.ago,      end_date: 2.months.from_now
  )
  GradingPeriod.new(
    start_date: 1.months.from_now, end_date: 3.months.from_now
  )

These two grading periods do *NOT* overlap, even thought the
end_date of the first is the same as the start date of the
second (again, these would need to be in the same group):

  GradingPeriod.new(
    start_date: 0.months.from_now, end_date: 2.months.from_now
  )
  GradingPeriod.new(
    start_date: 2.months.from_now, end_date: 3.months.from_now
  )

Fixes CNVS-19858

Change-Id: I0c901fa35f3225186948bbd8d61ef368cd15c939
Reviewed-on: https://gerrit.instructure.com/53953
Tested-by: Jenkins
Reviewed-by: Dylan Ross <dross@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Derek Bender <dbender@instructure.com>
2015-06-10 20:55:43 +00:00
Cody Cutrer c1344edb1d account authorization configs cleanups
* get rid of has_one
 * get rid of several methods on account that are unused or trivially
   replaced

Change-Id: I5a4f1e342b2bd465a240bbe701c2ab883b1f3878
Reviewed-on: https://gerrit.instructure.com/55240
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2015-06-05 15:45:47 +00:00
Strand McCutchen 05f4b9190e Extract Soft Deletion
fixes CNVS-20361

This is the first step in extracting soft deletion and
only touches grading period models. I audited other models
to see if this extraction would work for them, but no other
models met my criteria which are as follows

- [ ] defines workflow state of _only_ active and deleted
- [ ] active scope where state is active
      (not `workflow_state<>'deleted'`)
In `def destroy`:
  - [ ] state set to deleted
  - [ ] then save
  - [ ] runs callbacks

Many variants of soft deletion exist, including scoping
active to `workflow_state<>'deleted'`, not running
callbacks after save, and wrapping the state change in a
transaction block.

This is the first step in making soft deletion behave
consistently. There are approximately 30 models that have
an implementation of soft deletion.

Change-Id: I6cb48571377a4bb403285f95c058020b46ca3a30
Reviewed-on: https://gerrit.instructure.com/53821
Reviewed-by: Derek Bender <dbender@instructure.com>
Product-Review: Strand McCutchen <smccutchen@instructure.com>
QA-Review: Strand McCutchen <smccutchen@instructure.com>
Tested-by: Jenkins
2015-05-18 18:45:01 +00:00
Cody Cutrer 946116045a refactor PseudonymSessionsController
fixes CNVS-20394

split it into appropriate concerns. main points are:

 * /login never renders a login form - it redirects forward to the
   default auth controller based on the first account
   authorization config (or discovery url on the account)
 * /login/canvas is the new home of the old login form. this form is
   never rendered in-situ anymore - other places that used to render
   it now redirect to /login (and then forward to here), reducing
   their knowledge of SSO
 * /login/ldap ends up at the same place (cause LDAP auth is handled
   transparently)
 * /login/cas and /login/saml redirect forward to the first SSO
   configuration of the appropriate type. /login/:auth_type/:id can
   be used to select a specific one
 * if an SSO fails, it redirects back to /login with flash[:error]
   set. this can forward to the discovery url appropriately, or
   render an error page appropriately (the old no_auto=1, but now
   it's not layered on top of the login partial that didn't show a
   login form)
 * ?canvas_login=1 is deprecated. just go directly to /login/canvas
 * /saml_consume, /saml_logout are deprecated. they are processed
   directly by /login/saml and /login/saml/logout
 * /login/:id is deprecated - it forwards to /login/:auth_type/:id
   as appropriate (presumably only saml, since that was the only
   one that previously should have been using these links)
 * OTP has been split into its own controller, and separated into
   multiple actions instead of one all-in-one action
 * /logout has been vastly simplified. the login controller should
   set session[:login_aac], and on logout it will check with that
   AAC for a url to redirect to after logout, instead of /login.
   SSO logout is handled by each controller if they support it

test plan:
 * regression test the following functionality -
   * login with canvas auth
   * login with LDAP auth
   * login with SAML auth - and multiple SAMLs
   * login with CAS auth
   * MFA (configure, using, auto-setup)
   * Canvas as OAuth Provider flow
   * redirects to the login page when you're not
     logged in
   * failure of SAML/CAS (i.e. can't find user)
     show a decent error page and allows retry
   * "sticky" site admin auth (site admin is CAS/SAML,
     going directly to another domain logs you in with
     site admin)

Change-Id: I1bb9d81a101939f812cbd5020e20749e883fdc0f
Reviewed-on: https://gerrit.instructure.com/53220
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2015-05-15 14:44:38 +00:00
Derek Bender 88296a6753 generate and send submissions zip URL via API
fixes CNVS-16142

previously, if there was a quiz with file upload answer types,
those file submissions would not download because the path would
refer to assignments instead of quizzes. This first detects
if the assignment is a quiz type and then hands the api the
correct submissions url.

Test Plan:
1) Create a quiz with at least one question as a file submit type
2) Publish the quiz
3) Take the quiz as a student
4) As a teacher, go to the Gradebook Individual View. In the Content
   Selection area, choose the quiz from the "select an assignment"
   drop down
5) Click the "Download All Submissions" button in the Assignment
   Information section
6) The download process should complete successfully

Change-Id: I31a98cae291ceff86a7316d43900b70b209cfe4b
Reviewed-on: https://gerrit.instructure.com/46296
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Tested-by: Jenkins
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Derek Bender <dbender@instructure.com>
2015-05-01 20:56:54 +00:00
Strand McCutchen d6597c107c fix Style/EmptyLineBetweenDefs issue
Change-Id: Ib7b824043a7ac9196f06020e2ca42fe983565f0d
fixes: CNVS-20009
Reviewed-on: https://gerrit.instructure.com/52919
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Strand McCutchen <smccutchen@instructure.com>
QA-Review: Strand McCutchen <smccutchen@instructure.com>
2015-04-29 16:28:39 +00:00
Cody Cutrer a9f8e81b54 refactor account authorization configs into per-auth type classes
test plan:
 * basic smoke test configuring and using non-Canvas authentication

Change-Id: I45b5fda173a400d9eebb04d17d979e798d297c38
Reviewed-on: https://gerrit.instructure.com/50864
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2015-04-28 15:17:59 +00:00
Cody Cutrer 9834937c8c don't autorequire a bunch of gems that are rarely used
Change-Id: I09ed3686629b62849d392684d587f30cb2047013
Reviewed-on: https://gerrit.instructure.com/51853
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-04-09 18:47:50 +00:00
Cody Cutrer 8ed1edcbb1 spec: just truncate all tables, instead of known tables
avoid having to load all the gazillion models

Change-Id: I112fcc3c2230246187b490058c8199a8d572bddf
Reviewed-on: https://gerrit.instructure.com/51856
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-04-09 17:00:18 +00:00
Zach Wily 5d232f03af initial live events implementation
This commit adds a new module called LiveEvents that knows how to send a
certain set of events to Kinesis. The module is configured via
normal plugin settings per account. Once the plugin is configured with
a Kinesis stream, events will start getting sent to that stream.

Events are sent asynchronously, in a background thread.

test plan:
 * See `doc/live_events.md` for instructions on how to setup a local
   kinesis stream and configure the LiveEvents plugin.
 * Start tailing the stream with the command specified in
   `doc/live_events.md` in a terminal.
 * Perform the actions described in `doc/api/live_events.md` and verify
   that events show up in your Kinesis terminal with the correct data.

Change-Id: Id799688c972205a1eee84a673912f84b0c7abb57
Reviewed-on: https://gerrit.instructure.com/50324
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
Product-Review: Zach Wily <zach@instructure.com>
2015-04-03 15:22:33 +00:00
Benjamin Porter 4cb68ec577 Don't show announcement comments to non-students
When the user is not logged in, or is not enrolled in the course, don't
show student comments on announcements.

Fixes CNVS-19270

Test Plan:
    - Create an announcement in a *public* course as a teacher
    - As a student, leave a reply on the announcement
    - Verify that the reply shows up for students in the course, as well
      as the teacher and account admins
    - Log out, and verify that the comments are not visible to
      a non-user
    - Create an announcement in a non-public course and ensure that
      student and teacher and admin can all see them properly

Change-Id: Ide381f6271a1de66ac85f6c7b0e2a2557190991d
Reviewed-on: https://gerrit.instructure.com/50595
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Benjamin Porter <bporter@instructure.com>
2015-03-31 23:28:18 +00:00
Derek Bender 4f2723d672 scope show to context chain of course/accounts
resolves CNVS-19289

Testplan:
 - the api should handle the show action for all contexts
   (root accounts, sub accounts and courses)
 - a 404 Not Found should be thrown when attempting to access
   a grading period not 'owned' by the current context

Change-Id: Idb3e4c2d88b9e68e81f636d014bc027d0c30bde6
Reviewed-on: https://gerrit.instructure.com/50733
Tested-by: Jenkins
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Product-Review: Derek Bender <dbender@instructure.com>
QA-Review: Derek Bender <dbender@instructure.com>
2015-03-27 20:03:09 +00:00
Derek Bender eb133cd841 Fetch grading periods for all related accounts
Previously, the controller for grading periods only fetched active
grading periods for the current context and thus missed grading
periods on account chains.

Closes CNVS-18058

Test Plan: Create grading periods for root account, sub accounts
and courses. Ensure they all show up in the index action
of GradingPeriodsController

Change-Id: I9282b458207b8571022cd8ad3e33208131c8a743
Reviewed-on: https://gerrit.instructure.com/49120
Tested-by: Jenkins
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Robert Lamb <rlamb@instructure.com>
Product-Review: Derek Bender <dbender@instructure.com>
2015-03-24 17:41:46 +00:00
Spencer Olson e10989d780 refactor helper method to generate grading periods
closes CNVS-18224

test plan:
  -Verify automated tests pass. So long as the automated tests pass,
    the refactor of tests was successful.

Change-Id: Icae6c036f0b6bca58fc5beed290ab10590e4d9c7
Reviewed-on: https://gerrit.instructure.com/49029
Tested-by: Jenkins
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
2015-03-13 19:00:49 +00:00
Cody Cutrer 15ca8d65a2 remove basic auth support
2012 has definitely come and gone

Change-Id: Ifa6c74048b0afe38a6892ea305594ce81c4bc381
Reviewed-on: https://gerrit.instructure.com/49832
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-03-04 19:50:50 +00:00
James Williams 141b505f03 don't allow editing gradebook when course is unpublished
(also allow it to be published if it got in that state earlier)

test plan:
* create an unpublished course
* enroll a student
* add and publish an assignment
* visit the gradebook
* should not be able to enter a grade before
 the course has begun

closes #CNVS-18454

Change-Id: I9a3f894ad6bf130d359de5c4717cba9bee6704b3
Reviewed-on: https://gerrit.instructure.com/49047
Tested-by: Jenkins
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
2015-02-19 20:02:18 +00:00
James Williams 192b78d0b4 don't set existing enrollments to invited state on re-enrollment
* invite a student
* as the student, accept the invitation
* use the people page to re-enroll the same student
* should not set the enrollment back to "pending"

closes #CNVS-18004

Change-Id: Icfcc6a12400d63d132d01ceb93ef98f1c3344355
Reviewed-on: https://gerrit.instructure.com/47954
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-02-02 17:35:21 +00:00
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
Shawn Meredith 14501a0fb8 spec: disable cassandra table truncation spec_helper
Change-Id: I16d6a9bfaeb35f07c1faaa3051ad9753d3103bf7
Reviewed-on: https://gerrit.instructure.com/36592
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
2014-06-18 18:14:20 +00:00
Jake Sorce 21d8f43f85 new publish and un-publish course buttons
closes PS-1602

test plan:
  1. enable draft state on a course
  2. go to the course
  3. you should see the new buttons
     in the top right
  4. play around with them
  5. you should not be able to see course
     status if there are graded submissions
     in the course
  6. go to course settings
  7. you should see the course status now
     in the top right (published or unpublished)
  8. if there are graded submissions you should
     be able to hover the course status and get
     a tooltip saying you cannot unpublish
Change-Id: Idb7c27503f84eb489e1970b2061eb903e452de09
Reviewed-on: https://gerrit.instructure.com/36041
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jake Sorce <jake@instructure.com>
2014-06-16 21:56:14 +00:00
Jon Jensen 0a9a954a5d extract User.enrollment_conditions from user.rb, refs CAT-147
they're not relevant to *a* User, and they're needed by things other than
User.reflections.

test plan:
n/a, just refactoring to a (hopefully) better spot. existing and new specs
should cover all of this

Change-Id: I66ab5314582113ac549af5662bcf08a8ca5df580
Reviewed-on: https://gerrit.instructure.com/35082
Reviewed-by: Dave Donahue <ddonahue@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2014-05-22 20:54:03 +00:00
Cody Cutrer 8178266194 split yaml file loading out of Setting
refs CNVS-13024

Setting wasn't properly being initialized as unsharded because
it was loading before Switchman. The reason we need Setting before
switchman is just for yaml loading, so split that into its own
class.

Change-Id: I5456e103cb216dba2d5af4e9c20a697b468c923b
Reviewed-on: https://gerrit.instructure.com/35043
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-05-21 18:27:06 +00:00
Cody Cutrer 09076c680b use a cookie to remember site admin delegated logins
fixes CNVS-10415

test plan:
 * configure site admin with its own domain, and to use CAS auth
 * log in at site admin
 * go to another account with the same base domain (i.e.
   siteadmin.canvas.dev and accounta.canvas.dev)
 * it should redirect you to site admin's CAS server; and likely
   directly log you in to canvas, cause you're still logged in
   there
 * go directly to a course on a different account without being
   logged in; it should send you to site admin cas
 * log out on the site admin domain and the other domain
 * go to the other domain to log in; it should no longer redirect
   you to site admin cas

Change-Id: I72d5327193832264228305f73e849282c48780d3
Reviewed-on: https://gerrit.instructure.com/34425
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-05-20 13:44:16 +00:00
Jon Jensen e7582b1a40 spec: slight global speedup
change how we default to UTC for tests. this way we:
1. don't create Account.default if a given spec doesn't need it
   (explicitly or otherwise)
2. don't do an unnecessary Account#update_attributes before every spec

test plan:
specs, duh

Change-Id: Icd425b0e2b27bbfa6c95b713ae69c5fa36e14c14
Reviewed-on: https://gerrit.instructure.com/35069
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-05-19 22:12:09 +00:00
Cody Cutrer c6090faa0a allow enrolling users via sis from another root account
fixes CNVS-12963

test plan:
 * set up a trust from account A to account B
 * enable sis imports for account A and account B
 * add a user to account B with an SIS ID
 * add a course to account A with an SIS ID
 * do an sis import to account A for enrollments as user
   that is an admin in both account A and account B;
   specify the course from account A as the target,
   the user from account B, and add another column
   root_account with account B's domain
 * it should succeed, and enroll the user from account B
 * unenroll the user manually
 * do the import as a user that's an admin in account A,
   but not account B - it should fail citing permissions
 * remove the trust link from A to B
 * do the import as the user that's an admin in both;
   it should fail citing no usable login

Change-Id: Ie5b7b71bfe563da9c49d3aa2321586994634ccb5
Reviewed-on: https://gerrit.instructure.com/32133
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-05-13 17:19:48 +00:00
Braden Anderson 4fafdda484 discussions: separate group discussions from group assignments
fixes CNVS-4475

pre-checkout plan:
  * create a course
  * open people->groups
  * create a student group with multiple students
  * open discussions
  * create two topics
  * make one topic a group assignment

test plan:
  * open the topics you created
  * verify that a "group discussion" option replaced "group assignment"
  * verify that your group assignment is a group discussion
  * verify that your group discussion uses the same group set
  * verify that the old behavior of presenting child topics is retained
  * verify that your non-group topic is not a group discussion
  * verify that the "group discussion" flag cannot be changed for topics
      with replies

  * create a new discussion topic
  * verify that "group discussion" is available for ungraded topics
  * verify that changes to the field persist

  * create a new graded group discussion topic
  * post to one of the subtopics as a student in its group
  * open the gradebook as the teacher
  * verify that the student who posted has a submission but the other
      group members do not
  * verify that group members can be graded individually

Change-Id: Iada30628f0abdb7d7df4267d695553baf8b952d3
Reviewed-on: https://gerrit.instructure.com/33253
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-05-08 21:18:40 +00:00
James Williams b9201e13f2 allow subaccount admins to move courses to other accounts
test plan:
* create a subaccount (the "parent" subaccount)
* create more children subaccounts within that parent subaccount
* create an account admin user for the parent subaccount
* create a course beloning to one of the children subaccounts

* as the account admin user, confirm that you can visit
 the course settings page and use the drop-down box to
 change the courses' account to any child account that
 belongs to the parent subaccount
* also confirm that the drop-down box does not show accounts
 outside the parent subaccount (even if they're on the same root
 account)

fixes #CNVS-10501

Change-Id: I1d7cae8a19b926cabb3473ba950d29ab08ad25ce
Reviewed-on: https://gerrit.instructure.com/34009
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2014-05-05 16:43:00 +00:00
Joseph Rodriguez 32f45d6956 remove #grade_submission from QuizSubmission
fixes: CNVS-12565

test plan:
- as a student take a quiz
- verify that:
  - background submissions are working
  - end of time / date submissions are working
  - manual submsissons are working
- verify various question types are graded correctly
- verify outcomes work as previously defined

Change-Id: Ia85141559e8026993c0e270267947128a5a0466b
Reviewed-on: https://gerrit.instructure.com/33669
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Jason Madsen <jmadsen@instructure.com>
2014-04-23 19:28:03 +00:00
Mark Severson a1dde79530 extract handlebars_tasks gem
fixes CNVS-11180

test plan:
 * ensure the jst rake commands operate correctly
	 * jst:compile
	 * jst:ember

Change-Id: Ibe3109cf2708abf08783e06b180eba9299472ccb
Reviewed-on: https://gerrit.instructure.com/29920
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-04-21 19:48:22 +00:00
Mark Severson a1fac754d2 extract i18n_tasks gem
fixes CNVS-11181

test plan:
 * i18n rake tasks still operate correctly

Change-Id: I261973a947ce28840d6817f5a931f5221192e8db
Reviewed-on: https://gerrit.instructure.com/31441
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-04-21 03:19:47 +00:00
Stanley Stuart 94f3b1bd15 add submitted/unsubmitted quiz users endpoint to quizzes api
Test plan:
  - As a teacher, create a quiz.
  - Visit the quizzes API using JSONAPI headers. For that quiz,
    "submitted_students" should be null. You should get a URL back to
    the "unsubmitted_students" endpoint, which you can query and find
    the unsubmitted students.
  - As a student submit the quiz. As a different student, don't submit
    the quiz.
  - As a teacher, visit the quiz show endpoint for that quiz again. You
    should have "submitted_students" and "unsubmitted_students" under
    the "links" hash. Query these APIs using those URLs. The students
    returned from the link that looks like "?submitted=true"
  - As a student, you should not see "submitted_students" or
   "unsubmitted_students" under the "links" hash when querying
   the show API in JSONAPI format
  - In non-jsonapi format as any user, you should not see
   "unsubmitted_students" or "submitted_students"

closes CNVS-11687

Change-Id: I7094dfc37b0dde501e5a2c1f12ade983cd2a150a
Reviewed-on: https://gerrit.instructure.com/31223
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Stanley Stuart <stanley@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-04-18 21:04:23 +00:00
Nathan Mills 32b2ce407f extract attachment importer
fixes CNVS-12245

test plan:
*run a course migration on a course that has attachments
the attachments should come across

Change-Id: I897ec39bfa393835ee20cb8ff83918dcdddf57ff
Reviewed-on: https://gerrit.instructure.com/32965
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2014-04-18 16:37:00 +00:00
Shawn Meredith 94be92c91c spec: embedded reruns option
Change-Id: Ife0294ac8ba33ffdaa7c7149f9ed11e073c1ca23
Reviewed-on: https://gerrit.instructure.com/33367
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-04-16 22:11:13 +00:00
Nick Cloward f1009a38fe canvas kaltura gem
fixes CNVS-10479

test plan:
  - in a course with kaltura enabled
    - go to a discussion and add media
    - upload a video (use right tab, not the webcam)
    - save the video/discussion post
    - the video should be saved properly and viewable
      (this sometimes takes a minute of two)

Change-Id: I40b9174807707dd1fb41125e04705422a8711d5d
Reviewed-on: https://gerrit.instructure.com/32024
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-04-16 19:39:45 +00:00
Shawn Meredith 2bdf2c09da spec: rspec2 --tags for parallel_excluded specs
Change-Id: I20bf507acb2d0c26d34220d8e52fdf02cbde3e12
Reviewed-on: https://gerrit.instructure.com/32627
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Shawn Meredith <shawn@instructure.com>
Product-Review: Shawn Meredith <shawn@instructure.com>
QA-Review: Shawn Meredith <shawn@instructure.com>
2014-04-03 08:04:52 +00:00
Shawn Meredith 0a2416cdec spec: rerun during paralleized_specs runtime and timeout fix
Change-Id: I8e50f989bcbbe762bb5d6d91243f81af1bf2de86
Reviewed-on: https://gerrit.instructure.com/32488
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-03-29 10:17:54 +00:00
Braden Anderson 4f52a5e4c3 outcome gradebook: add export link
fixes CNVS-10638

test plan:
  * open outcome gradebook
  * select a section
  * click on "export report"
  * download and open the export
  * verify that the export format matches the Jira documentation
  * verify that the export data matches the data from your browser

Change-Id: I35bd78719880026b71b30da5794c9afe7dd31868
Reviewed-on: https://gerrit.instructure.com/31774
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-03-28 20:37:03 +00:00
Simon Williams 4f1b79337c fix Multipart::Post Content-type header
This reverts commit e3148346df
This reverts commit 16f518a130
This partially reverts 9d34baed66

fixes CNVS-12021

test plan (e3148346df)
 - rails 3 specs should pass
test plan (9d34baed66)
 - import content including a video file into a course
      (such as the QTI file attached to CNVS-11602)
 - the import should complete
test plan (16f518a130)
 - submit a document to turnitin
 - it should successfully receive a score

Change-Id: I0622d9eceee4b94e488f103db68290f1b641b555
Reviewed-on: https://gerrit.instructure.com/32333
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2014-03-26 15:21:09 +00:00
Cody Cutrer 4aaea4c5c6 spec: fix mysql when models don't have tables
Change-Id: I6d4e7c314d4bce58c28dff659c1a498b40cea40a
Reviewed-on: https://gerrit.instructure.com/32064
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-03-19 14:26:20 +00:00
Cody Cutrer b3f125a0eb fix rails 3 spec mocking
if mocha was initialized prior to rails (i.e. if a spec like swagger
that doesn't initialize rails runs prior to a spec that needs rails),
CollectionProxy would remove the mocha methods when it was first defined.
so make sure we restore them

Change-Id: Icf9b1a2598fef279c32b37dd7afe52e15c07c23e
Reviewed-on: https://gerrit.instructure.com/31934
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
2014-03-18 14:37:21 +00:00
Cody Cutrer 309541eb2b fix cache forcing for rails 3
just use stubs, so we don't hide switchman's extensions

Change-Id: I65012c7221ce02f355035746ed06d42220af59b7
Reviewed-on: https://gerrit.instructure.com/31716
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-03-17 22:00:34 +00:00
Shawn Meredith a35f471716 spec: spec timeout handling rails3
Change-Id: I6037c94239026e85e737dd210a6a6879c546ab76
Reviewed-on: https://gerrit.instructure.com/30958
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-03-07 22:48:32 +00:00
Cody Cutrer 39ddecc5c3 remove webrat, and fix pseudonym sessions controller spec for rails 3
webrat is abandonware, and doesn't work properly with rails 3

Change-Id: I34db6c150b6715e33a30d531941b76458090ce63
Reviewed-on: https://gerrit.instructure.com/31457
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-03-06 21:19:16 +00:00
Cody Cutrer 68b7dcc141 make grade passback specs more robust
especially in rails 3

just use stubs instead of starting up a second thread and opening a
connection

Change-Id: I52837c6ff65ed62a225c0a4df61c1a73df2a1526
Reviewed-on: https://gerrit.instructure.com/31320
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-03-06 15:23:50 +00:00
Raphael Weiner 4dc762217a extract multipart gem
Change-Id: Id4aa4d522bba2d87008d02249893a65387ec563c
Reviewed-on: https://gerrit.instructure.com/30052
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-02-28 23:00:09 +00:00
James Williams 16296d3870 fix compare_json spec helper in preparation for rails 3
Change-Id: Ibc73cddcd87012ef3776c2c5a99b305fb3c2878b
Reviewed-on: https://gerrit.instructure.com/30869
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-02-27 15:38:52 +00:00
Cody Cutrer 9d78ba9ab0 fix auth_spec for reails 3
* use 'HTTP_AUTHORIZATION' for header, not :authorization or
   'Authorization'
 * fix stubbing of forgery protection (in Rails 3, the instance method
   doesn't chain to the class method)
 * fix re-ordering of AuthLogic callback chain for rails 3

Change-Id: I6f190995cee7fd54076e786b17eba430ae03a1c0
Reviewed-on: https://gerrit.instructure.com/30796
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-02-25 19:41:39 +00:00
James Williams 44aafc0c16 spec: explicitly save users after enrolling in spec_helper
enroll_user touches the user, but because touch no longer saves,
this changes things for some specs

Change-Id: Ie5be09e0b30ed23e14a8ba2d39905bf7fa4c1346
Reviewed-on: https://gerrit.instructure.com/30608
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-02-21 21:09:07 +00:00
Cody Cutrer b25e5c084c fix pend_with_bullet when you don't have bullet
Change-Id: I21d38b5f79d18b311dc94dfde8427e735df59125
Reviewed-on: https://gerrit.instructure.com/30362
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-02-20 20:44:27 +00:00
Derek DeVries 2f9c6f82e1 rails3: path proxies to request.path in rails3, which doesn't include query params
Change-Id: I278ac02f4f9f89a4cc11532c85c98f615304f360
Reviewed-on: https://gerrit.instructure.com/30162
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
QA-Review: Derek DeVries <ddevries@instructure.com>
2014-02-14 19:36:42 +00:00
Cody Cutrer 703bd8a19f fix running specs in rails 3 without development gems frd
Change-Id: I25fe977ffaaa2421b6bf1803a473b84e13a0e3e1
Reviewed-on: https://gerrit.instructure.com/30124
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-02-13 21:17:07 +00:00
Cody Cutrer 170a6d6d7d fix running specs in rails 3 without development gems
Change-Id: I1b659ab2f30afc460a65ad3c8851f472d2feba24
Reviewed-on: https://gerrit.instructure.com/30091
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-02-13 17:36:10 +00:00
James Williams 6e80bd0188 view spec fixes for rails 3
* fix view spec rendering to include helpers
* re-implement have_tag rspec matcher
* fix problems with finding routes to
 unsaved records

Change-Id: I6ed267fcf5e8e32a62ee059be46371bc0ea35603
Reviewed-on: https://gerrit.instructure.com/30016
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-02-13 16:50:55 +00:00
James Williams 8c3c32e860 enable debugging in rails 3 specs without '-d' option
Change-Id: I898645bb63d1bb76f888cbf23fe867d6d71c7229
Reviewed-on: https://gerrit.instructure.com/30018
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-02-12 15:56:06 +00:00
Cody Cutrer 497dd2f917 fix context_modules_controller_spec for rails 3
Change-Id: I453aa576bad33454b669b6efc4810a15ad7bcdd7
Reviewed-on: https://gerrit.instructure.com/29844
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-02-11 17:08:11 +00:00
Cody Cutrer 06b77a8aff spec: fix outside_transaction? for Mysql2Adapter
Change-Id: Ia77d2e2d2bce42450e7936b1ae3f7feb6dcbd542
Reviewed-on: https://gerrit.instructure.com/28575
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-02-10 21:52:29 +00:00
Derek DeVries 237e89713a fix specs for rails3 to expect a 404 response instead of catching an exception
Change-Id: I7af57c4fcae02f1ba5c0fe5e446a0b6229bc0ca4
Reviewed-on: https://gerrit.instructure.com/29796
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
QA-Review: Derek DeVries <ddevries@instructure.com>
2014-02-07 20:01:34 +00:00
Cody Cutrer 6b47a6c1e6 ensure extensions will work for specs with multiple shards
Change-Id: I4ff6ab571f7995469a89f605386e9f6c49718d19
Reviewed-on: https://gerrit.instructure.com/29677
Reviewed-by: Jon Willesen <jonw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-02-05 22:46:46 +00:00
James Williams c13845ce0f use assign_attributes instead of attributes= for rails 3 compatibility
Change-Id: I783618bc5457ea53a9d59ab36d3ccf7b7fde7b2e
Reviewed-on: https://gerrit.instructure.com/29595
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-02-05 20:56:38 +00:00
Cody Cutrer 50edbe1517 spec: fix several AR::Base specs for rails 3
* don't define message on Object. that's scary
 * change some deprecated rspec syntax
 * pend fake_arel specs in rails 3

Change-Id: Ib53f4bfd8edc24be48e1e8b29162fa1210175bc5
Reviewed-on: https://gerrit.instructure.com/29280
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-01-27 18:28:17 +00:00
Jacob Fugal d7d3ccce4f clean up code around cache forcing
refs CNVS-9546

pull the common code into

 * Rails.force_cache!,
 * Rails.unforce_cache!,
 * Rails.force_cache{},
 * Rails.disable_cache!, and
 * Rails.disable_cache{}

methods. leave the implementation of those methods close to the code
they're replacing for now, but in the near future we'll reimplement
those methods to be cleaner (i.e. not mucking around with version
specific internal constants and such).

test-plan: specs

Change-Id: Ie5f47a64f57dea0034933d8dad84e17633869a49
Reviewed-on: https://gerrit.instructure.com/28086
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2014-01-27 16:58:07 +00:00
Cody Cutrer ce806f6657 don't allow integration specs anymore (use request specs)
Change-Id: I560493461eaaf05941e5ea14c95b094718e13810
Reviewed-on: https://gerrit.instructure.com/29022
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-01-24 17:23:40 +00:00
James Williams d9ae1efd2c spec: replace it_should_behave_like with include_examples
Change-Id: I8a10679218b9a6ff8485b7822a21c704bdfaa398
Reviewed-on: https://gerrit.instructure.com/29213
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-01-24 16:02:26 +00:00
Joshua Simpson 1e81ea7caa move quiz into quizzes namespace as a precursor to enginifying
fixes CNVS-10679
this commit refactors quiz into a quizzes namespace. it contains various
shims to facilitate the data migration of polymorphic relationships
('Quiz' -> 'Quizzes::Quiz').  JIRA contains several tickets linked to
the above tickets in regards to removing these shims after the data
migration, as well as the strategies on reverting the shims once the
data migration is complete.
Change-Id: I30c566d60a87af6ee83e9d0041fdcb909ead6a89
Reviewed-on: https://gerrit.instructure.com/28573
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2014-01-24 00:08:46 +00:00
James Williams 9da97b6fee add :context option to group spec_helper
Change-Id: Ie65a2a2b9e306fd8ec6eb47e317ad42c43db2c48
Reviewed-on: https://gerrit.instructure.com/28975
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-01-23 17:17:04 +00:00
Brian Palmer 0849ccb1a1 extract canvas_cassandra gem
The gem still lives in the canvas-lms repo, but has separate tests, and
knows nothing about Canvas proper. Canvas' usage of the gem is through
Canvas::Cassandra::DatabaseBuilder (and Canvas::Cassandra::Migration).

Change-Id: I51878055647225755d54edc5595b8189b7bea3cc
Signed-off-by: Stephan Hagemann <stephan.hagemann@instructure.com>
Reviewed-on: https://gerrit.instructure.com/28632
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2014-01-22 22:49:35 +00:00
Cody Cutrer cc93da5b8c integration specs are request specs in rspec2
Change-Id: Iffee4243a9fa27e43f7020919a18777031e9724f
Reviewed-on: https://gerrit.instructure.com/28833
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-01-21 19:29:58 +00:00
Cody Cutrer a69dce672b spec: create announcements in the past to avoid sub-second precision problems in mysql
refs CNVS-7032

Change-Id: Iccb42f6f2ae2a13f2a3c002305c76ceb405693e0
Reviewed-on: https://gerrit.instructure.com/28803
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-20 19:59:29 +00:00
Hannah Bottalla 0184eca5d2 spec: bullet modifications
Change-Id: I89015da3706d2620065e948adb585613b9492b83
Reviewed-on: https://gerrit.instructure.com/28352
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-01-17 23:18:44 +00:00
Anthus Williams 40c5c1f5f7 fix for rails3 refactoring of TestUploadedFile
in rails 3, ActionController::TestUploadedFile has
been moved to Rack::Test::UploadedFile. This commit
simply updates uses of TestUploadedFile to work
with this new structure

Change-Id: Ib31159c635f033a13908608dffeea88c8f719086
Reviewed-on: https://gerrit.instructure.com/28234
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Anthus Williams <awilliams@instructure.com>
QA-Review: Anthus Williams <awilliams@instructure.com>
2014-01-17 17:53:18 +00:00
Anthus Williams a8c8e8c46a option to restrict global announcements by role
Gives account admins the options to display
announcements to users that have a given role in
at least one course. This will enable us to, e.g.
write surveys intended for teachers and ensure
they will not be seen by K-12 students, etc.

Currently the granularity of this feature extends
only to the base enrollment types, (defined in
RoleOverride::ENROLLMENT_TYPES) not to the custom
roles that may have been defined in a given
account.

Fixes CNVS-8319

Test plan
- While logged in as an account admin or site
admin, browse to /accounts/N/settings#tab-announcements
and add a new announcement
- You should see the enrollment types delineated as
checkboxes
- Create an announcement defined for one role but
not another
- Log in as a user who has one of the defined roles
in at least one course to verify you are seeing the
announcement
- Log in as a user who has does not have any of
the defined roles in any of his enrolled courses
and verify that you do not see the announcement
- Verify it works for "Unenrolled users" (which is
not, in fact, a type of role in the same vein as
the rest) by logging in as a user who is not
enrolled in any courses
- Check "Account admin" option with a user who
does not have any role for which the announcement
is defined, but is an account admin (added under
the Admins section of /accounts/N/settings)

Change-Id: I7d141c7c38dc05ae72991de3a710043327d615f6
Reviewed-on: https://gerrit.instructure.com/27008
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Munda Frazier <munda@instructure.com>
2014-01-09 19:54:21 +00:00
Paul Hinze 75dba33a5d use https for all kaltura communication
kaltura is always available over https, and requesting a secure resource
from within a plain http page is not harmful.

so we can simplify the code and pave the way for a media service that
only runs over https by converting everything to request kaltura
resources via https.

to accomplish this we pull together all of the myriad ways that HTTP
requests were being made from canvas's kaltura client. then in the
unified code path we ensure SSL is being used to make requests.

we're also pulling in webmock to make for better tests of the kaltura
client code with stubs closer to the HTTP layer.

unfortunately this change ends up touching most of kaltura
functionality, so the test plan is basically a full kaltura regression
test.

test plan:
 - upload a video to kaltura; once it's done transcoding, the thumbnail
   should work, and the video should play
 - upload a video via canvas files, then embed it in some content; do
   the same verification
 - record a video using your webcam; verify it works

Change-Id: If5f67469fee07db80188911a0c7edd256c94c0a3
Reviewed-on: https://gerrit.instructure.com/28100
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Paul Hinze <paulh@instructure.com>
2014-01-07 17:46:49 +00:00
Cody Cutrer 8ccc390121 use official mocha with fix for superclass stubs
Change-Id: I11945f52b8fcfed35083395252d8081e6e7bd9f9
Reviewed-on: https://gerrit.instructure.com/27953
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-03 03:53:59 +00:00
James Williams 3971d98f23 fix spec deprecation warnings for rails 3
Change-Id: I896138df06b396b495728a6488d9780dec09d85e
Reviewed-on: https://gerrit.instructure.com/27935
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2013-12-30 20:54:07 +00:00
Stanley Stuart 5f2089c889 import ActiveModel::Serializers port and convert quizzes api to it
test plan:
  - The quiz api should work like it normally does when you don't pass
    an 'Accept: application/vnd.api+json' header.
  - The quizzes index page and quiz edit page should work like they
    always do.
  - Testing the Quizzes API for "jsonapi" style:
    - For all requests, you MUST have the "Accept" header set to
      "application/vnd.api+json"
    - Test all the endpoints (PUT, POST, GET, INDEX, DELETE) like you
      normally would, except you'll need to format the data according to
      the next few steps:
      - For "POST" and "PUT" (create and update) requests, you should send
        the data like: { "quizzes": [ { id: 1, title: "blah" } ]
      - For all requests (except DELETE), you should get back a response
        that looks like: { "quizzes": [ { quiz you requested } ]
    - For the "delete" action, you should get a "no content" response
      and the request should be successful

Change-Id: Ie91deaeb6772cbe52a0fc46a28ab93a4e3036061
Reviewed-on: https://gerrit.instructure.com/25997
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Stanley Stuart <stanley@instructure.com>
2013-12-26 20:32:39 +00:00
Jacob Fugal 615afb22d8 put the switch to test environment back in
accidentally removed in 4c2250d

test-plan:
 - have RAILS_ENV=development in your shell
 - run specs
 - they run with RAILS_ENV=test

Change-Id: I6f2baa5ed523535f2c24f3eb26204455717b33fc
Reviewed-on: https://gerrit.instructure.com/27637
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
2013-12-18 16:42:57 +00:00
James Williams 2d44a98248 integrate with switchman in preparation for rails 3
Change-Id: Ib2147e2a5c388ba56c1e558b414da9b7ec4c9cd2
Reviewed-on: https://gerrit.instructure.com/27614
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2013-12-18 15:42:37 +00:00
Shawn Meredith 4c2250d537 spec: parallel simple_cov
Change-Id: I774ce9a451cb01a6ff49df9e4b2bf4f7d753def3
Reviewed-on: https://gerrit.instructure.com/27608
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Shawn Meredith <shawn@instructure.com>
2013-12-18 07:30:03 +00:00
James Williams 9eab1033fa fix truncate_all_tables for rails 3
Change-Id: Ib035e63de191617946be167a1645aab182a7ced6
Reviewed-on: https://gerrit.instructure.com/27434
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>
2013-12-13 20:26:14 +00:00
Shawn Meredith 531cd157ef spec: spec_helper parallel require pathing fix
Change-Id: I1a6b51bd3614768385a6db840457841422599aef
Reviewed-on: https://gerrit.instructure.com/26836
Tested-by: Shawn Meredith <shawn@instructure.com>
Reviewed-by: Shawn Meredith <shawn@instructure.com>
QA-Review: Shawn Meredith <shawn@instructure.com>
Product-Review: Shawn Meredith <shawn@instructure.com>
2013-11-28 08:53:57 +00:00
Shawn Meredith a2a7b78336 spec: parallelized_specs rspect handling
Change-Id: I7f573272b169132908f0f0be5a3e0e558a16b777
Reviewed-on: https://gerrit.instructure.com/26671
Reviewed-by: Shawn Meredith <shawn@instructure.com>
Product-Review: Shawn Meredith <shawn@instructure.com>
QA-Review: Shawn Meredith <shawn@instructure.com>
Tested-by: Shawn Meredith <shawn@instructure.com>
2013-11-28 08:33:03 +00:00
Shawn Meredith 7a077d32bb spec: simple cov rcov formatter
Change-Id: I1e21da36433a03efb46e531f3ddceddad95c8fbc
Reviewed-on: https://gerrit.instructure.com/26751
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Kyle Rosenbaum <kyler@instructure.com>
QA-Review: Kyle Rosenbaum <kyler@instructure.com>
Product-Review: Kyle Rosenbaum <kyler@instructure.com>
2013-11-26 21:33:42 +00:00
Jeremy Stanley dcf3df456b move draft state under feature flag umbrella
fixes CNVS-9496

test plan:
 - draft state feature should show up in site admin feature
   flags, or root account feature flags when called as site
   admin
 - when site admin hits "allow" for the feature, it should
   appear in the root account administrator's settings
   in "Off" state
 - the root account admin should be able to "Allow" the setting
   which allows a sub-account or course to turn it on
 - when the feature is turned on via the Feature Settings tab
   or features API, draft state functionality should appear
   in the course wiki pages and elsewhere

Change-Id: Id7403f2a8371b0a7bfebffbb8f29330fff5c94c5
Reviewed-on: https://gerrit.instructure.com/26308
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
2013-11-26 20:43:49 +00:00
Nick Cloward 711f33c07e add option for course grade change (log auditing)
fixes: CNVS-348

This adds grade change auditing functionality.  It uses cassandra and is built
after the authenication auditing.  A new API endpoint was created to query these
logs.  Permissions for this is a domain account.  The logs can be quiried by
assignment, course, student, and grader.

Refer to: https://gollum.instructure.com/grade-auditor-implementation

Test Case:

  Setup:
    - Create a course with a student and an assignment.

  1. Grade an assignment for a student.
  2. The auditor should create a record in cassandra.
  3. Query the endpoint should return the audit event.
      - Query by Assignment
      - Query by Course
      - Query by Student
      - Query by Grader
  4. Ensure permissions are valid by querying with a non root account admin.
  5. Permissions should be changable by site_admin under account permissions.

Change-Id: I0a1cf867d5d1b5bfbdeacc7eac81747f8732025a
Reviewed-on: https://gerrit.instructure.com/25961
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2013-11-21 20:53:27 +00:00
Jacob Fugal d53ff776c7 only use homebrew NilStore with rails2
refs CNVS-4704

we can use the built in :null_store with rails3

Change-Id: I0dc6c441da4f300fe8ee870b8c676c8e449d1830
Reviewed-on: https://gerrit.instructure.com/26332
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2013-11-19 19:46:08 +00:00
Hannah Bottalla 58df738069 spec: public_courses_spec
separate public courses spec

Change-Id: I12d0f7df432a62564db0070fe9a12390a05f55e3
Reviewed-on: https://gerrit.instructure.com/26096
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Shawn Meredith <shawn@instructure.com>
Product-Review: Shawn Meredith <shawn@instructure.com>
QA-Review: Shawn Meredith <shawn@instructure.com>
Tested-by: Shawn Meredith <shawn@instructure.com>
2013-11-14 00:02:59 +00:00
Jon Jensen b9a3185a41 spec helper stub
needed for g/24755 so that plugin spec tweaks pass before it hits master

test plan:
n/a

Change-Id: Ia3160024965a1f2916ef8a80a4a133516483c624
Reviewed-on: https://gerrit.instructure.com/26063
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>
2013-11-07 16:24:58 +00:00
Jacob Fugal fadf690fe0 require appropriate file for testing uploads
refs CNVS-9166

test-plan: N/A

Change-Id: Ie9ed104579961f0af67b9453ecc43670d48ecbac
Reviewed-on: https://gerrit.instructure.com/25736
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-10-29 19:02:55 +00:00
Jacob Fugal b172b38fb4 consider_all_requests_local in specs for rails3
refs CNVS-9166

was already fixed in application setup, but not in these specs

test-plan: N/A

Change-Id: I7aaf2d487806c10b7c30dbd7e056e7b26e475875
Reviewed-on: https://gerrit.instructure.com/25732
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2013-10-29 17:12:02 +00:00
Cody Cutrer 7458f6af24 cassandra 1.2/2.0 compatibility
refs CNVS-7877

 * counter updates have to be in their own batch in 1.2+
 * add the use_cql3? method to cassandra gem, even
   though we're not updating it yet
 * slight change in syntax for table creation
 * 1.2 doesn't return schema info in the schema cql command;
   use a query to get tables

Change-Id: I22642b0fb99e744080f9a7efd0b3d0372de020b9
Reviewed-on: https://gerrit.instructure.com/25361
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-10-23 20:23:51 +00:00
Jon Jensen 2b7d8c2126 spec: don't create PseudonymSession in pseudonym factory
fixes CNVS-8756

this fixes some unrelated plugin specs that fail iff PseudonymSession is
already loaded

also it's The Right Thing To Do™, because having an automatic session for
the factory makes no sense and slows down specs

test plan:
n/a, it's a spec fix

Change-Id: Id7ead2f519868eb10272e154ffdc8622ee5e17ab
Reviewed-on: https://gerrit.instructure.com/25332
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>
2013-10-16 18:36:54 +00:00
Cody Cutrer 5302d44410 spec: serialize objects for MemoryStore and NilStore
to catch problems when using a "real" cache in dev/prod

Change-Id: Ic9ed6bc0420e3435d49ac0be756ba66a6f3cb0f2
Reviewed-on: https://gerrit.instructure.com/25217
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-10-14 16:25:03 +00:00
Jacob Fugal dfab0425e3 use CANVAS_RAILS2 for conditionals
rather than CANVAS_RAILS3 or Rails.version

this is to be consistent, and to reinforce that any "special" branches
are for rails 2.3 backwards compatibility while trying to target rails
3, rather than rails 3 "forwards compatibility".

Change-Id: I4494b65e3f71108a43d09032c1569c478646a828
Reviewed-on: https://gerrit.instructure.com/24998
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2013-10-10 15:58:43 +00:00
Cody Cutrer 1ffd9845c9 spec: remove deprecated helper
no longer necessary to do this manually in specs

Change-Id: I7f121743a5059234560c431c5225485124d85b5d
Reviewed-on: https://gerrit.instructure.com/24769
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2013-10-02 17:01:23 +00:00
Cody Cutrer a19b3ef8dd spec: run transaction commit callbacks when down to 1 transaction
removes need for run_transaction_commit_callbacks all over the place

Change-Id: Id878276ed86bb37f625ef34412b16d1f75a63bca
Reviewed-on: https://gerrit.instructure.com/24758
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-10-01 23:51:04 +00:00
Cody Cutrer d3f0b18684 validate nullness in the db on a bunch of columns
fixes CNVS-7414

Change-Id: I60978f66d88d916dc5736dbb975715172bd1e14b
Reviewed-on: https://gerrit.instructure.com/23141
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>
2013-09-12 22:20:39 +00:00
Mark Severson 2b0a891d80 remove hide_from_students from the new pages UI
test plan:
 - start with draft state disabled
 - for each step, exercise the api (as a teacher) to confirm the
   expected values
 1) create pages with different hide_from_students values
    a) as a teacher
       hidden pages should be visible; the hidden flag should persist
    b) as a student
       hidden pages should not be visible
 2) using the api, update published and hide_from_students
       (together and separately)
    a) the published value should not be affected
    b) the hide_from_students value should be updated when set

 3) enable draft state
    a) as a teacher
       previously hidden pages should be visible, but unpublished
    b) as a student
       previously hidden pages should not be visible
 4) edit a page
    a) ensure the "Hide from students" option is gone
 5) publishing pages should behave as expected
    a) published pages should be visible to students
    b) unpublished pages should not be visible to students
 6) using the api, update published and hide_from_students
       (together and separately)
    a) the hide_from_students value should not be affected
    b) the published value should be updated when set

 7) create new pages with different published states
    a) as a teacher
       unpublished pages should be visible, but unpublished
    b) as a student
       unpublished pages should not be visible
 8) disable draft state
    a) as a teacher
       previously unpublished pages should be marked hidden
    b) as a student
       previously unpublished pages should not be visible

fixes CNVS-7617

Change-Id: I395e0b2639543a64d9e2bc8d9377c78cf36f42d6
Reviewed-on: https://gerrit.instructure.com/23618
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-09-04 22:22:21 +00:00
Cameron Matheson b469af93cc make Assignment#group_students return distinct students
fixes CNVS-7823, CNVS-7847

Test plan:
  * enroll a student in multiple sections
  * make a group assignment
  * comment on the group assignment submission for the student with
    multiple sections
  * the student should receive one copy of the comment (not multiple)

Change-Id: I26f44ef054fdb136f180c949d0676fc0168827a8
Reviewed-on: https://gerrit.instructure.com/23886
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
2013-09-03 23:09:18 +00:00
Joel Hough 0348f84d8e add included messages and recipients to add_message endpoint
fixes CNVS-7676

test plan
- use the add_message endpoint to add a message, including
 recipients that weren't in the conversation and some included
 messages
- ensure that the new recipients are added to the conversation
 and can see the new message as well as the included messages
- add a message that excludes some recipients who are already
 conversation participants
- ensure that the excluded participants cannot see the new message

Change-Id: Id4f1ed741514c16cdafd81609d82e5c66aae85ac
Reviewed-on: https://gerrit.instructure.com/23627
Reviewed-by: Jon Willesen <jonw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2013-08-23 19:45:55 +00:00
Simon Williams 147d171aa1 correctly maintain assignment/rubric <-> outcome links
There are a few old LearningOutcomeResults that have a nil artifact, and
many that have a Submission as an artifact.  We want to get rid of these
because they come from bad data, and step 1 toward that goal is to stop
creating them and hide them in the UI.

The LORs with a nil artifact are very old and I believe came from a very
early incarnation of outcomes.  The LORs with a Submission as an artifact
came from a combination of two code problems.  The first was old code
that allowed an assignment that was aligned with an outcome but did not
have a rubric to create LORs directly based on it's submission.  The
second was a bug that prevented the assignment <-> outcome link from
being destroyed when a rubric with an outcome was removed from an
assignment.

fixes CNVS-7495
fixes CNVS-7498

test plan:
- try different combinations of adding a rubric with an outcome to an
  assignment.
- when you grade the assignment, the grade create a learning outcome result
  (which can be seen on the outcome show page, or in the account outcome
  report) if the rubric+outcome are currently attached to the assignment.
- so for example, add a rubric with an outcome, check, remove just the outcome
  row, check, add a new outcome row, check, remove the whole rubric, check.
- be sure to check both the show page and the outcome report

TODO:
- datafix migration

Change-Id: I37700e3e5c08fc6cfb8fcf1cac42ea6693fcaba3
Reviewed-on: https://gerrit.instructure.com/23303
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2013-08-20 22:40:01 +00:00
Jon Jensen d72b73b217 Revert "ensures all users accept terms of use"
Turns our we *do* want to grandfather in existing users :P

This reverts commit ae6d9033ac.

Change-Id: I7b109375a4844ef0291f0f72d89028b39d2289a0
Reviewed-on: https://gerrit.instructure.com/23384
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-08-16 16:44:40 +00:00
Landon Wilkins ae6d9033ac ensures all users accept terms of use
fixes CNVS-7385

test plan:
1) in a console:
  # grab a user of your choice
  u = User.find(5)
  # make it seem as if they have never accepted the terms before
  u.preferences[:accepted_terms] = nil
  u.save!
2) log in as that user
3) verify that you are required to accept the terms of use

Change-Id: Ibc314040f35d3d7418a3b31c7280188db86a552b
Reviewed-on: https://gerrit.instructure.com/23110
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-08-13 19:33:46 +00:00
Jon Jensen e04b052d87 require terms by default, fixes CNVS-7330
they were required prior to our new settings refactors. this way we don't
need to go set it in prod

test plan:
1. terms should be required when registering at /register
2. terms should be required when activing an account (via course
   invitation email)
3. in the console, do Setting.set('terms_required', 'false')
4. terms should no longer be required on those pages

Change-Id: Idb13727839b847845cd4dacde4797e4e1571b42f
Reviewed-on: https://gerrit.instructure.com/22988
Reviewed-by: Mark Ericksen <marke@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-08-12 15:57:51 +00:00
Shawn Meredith 1aa79fe053 spec: simple_cov spec_helper formatter tweak
Change-Id: I967eeb8554d0d7355000d691fbb68e1452f6cc21
Reviewed-on: https://gerrit.instructure.com/23190
Reviewed-by: Shawn Meredith <shawn@instructure.com>
Product-Review: Shawn Meredith <shawn@instructure.com>
QA-Review: Shawn Meredith <shawn@instructure.com>
Tested-by: Shawn Meredith <shawn@instructure.com>
2013-08-09 06:22:47 +00:00
Jon Jensen 5a6311d286 group category API refactor
refs CNVS-6659

* move validation logic into model
* standardize api error messages
* deprecate split_group_count
* document group_limit
* actually require name (since that's what the api says)
* disallow setting self_signup when editing account categories since it
  shouldn't be an option (and is totally broken)

test plan:
1. run specs
2. regression of creating/editing categories on group management page

Change-Id: Iccdd4e2e98978943f0562aad5c8ac055048d204d
Reviewed-on: https://gerrit.instructure.com/22493
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-07-26 17:03:27 +00:00
Shawn Meredith 51d2968f84 simplecov formatter tweak
Change-Id: I0ecacd2dbc7cb89fa9ef5b17c0b1d69befd90ad1
Reviewed-on: https://gerrit.instructure.com/21555
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>
2013-07-08 19:39:41 +00:00
Cody Cutrer 9412c19ace fix cross-shard user_account_association creation
refs CNVS-6202

test plan:
 * run specs with a foreign key on user_acccount_associations(user_id)
   (in a later commit, cause we're not ready to add it yet)

Change-Id: I30fc37da78232c1b18b834309f67c365a346b892
Reviewed-on: https://gerrit.instructure.com/21753
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-06-27 19:38:23 +00:00
James Williams cd3b30b816 fix media_object caption permissions
test plan:
* upload a video file
* identify the attachment id from the file's download url
 (e.g. '/courses/:course_id/files/:attachment_id/download')

* set the media object's user_id to nil by
 entering the following commands into the console:

id = [[INSERT ATTACHMENT ID HERE]]
mo = Attachment.find(id).media_object
mo.user = nil
mo.save!

* confirm that, as any course admin user, the 'CC'
button appears when previewing the video

fixes #CNVS-3855

Change-Id: I00b8ec4de50850cffee7be1332d811909d85932a
Reviewed-on: https://gerrit.instructure.com/21596
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
2013-06-19 21:29:10 +00:00
Simon Williams d96ba9c601 finish removing course.publish_grades_immediately
this was removed from the UI in Mar 2011 but was never completely ripped out.
we'd like to remove it now since it was adding extra complexity for no benefit.

closes CNVS-5929
refs #3974

test plan:
- create/update/delete an assignment from the index page, and the show page
- grade an assignment (with and without muting)
- test assignment notifications (with and without muting)
  - creating an assignment
  - editing an assignment
  - changing a due date (after 3 hours of being edited)
  - grading an assignment

Change-Id: Ie455bed41154018b5bd2c9c0e69e1e3285a0ac09
Reviewed-on: https://gerrit.instructure.com/20778
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2013-06-04 18:11:08 +00:00
Shawn Meredith 1d09cef4ea require simplecov fix
Change-Id: Ieb1dbfd5f0d8dfab1445e5077009b35306c6d9ea
Reviewed-on: https://gerrit.instructure.com/21089
Reviewed-by: Shawn Meredith <shawn@instructure.com>
Product-Review: Shawn Meredith <shawn@instructure.com>
QA-Review: Shawn Meredith <shawn@instructure.com>
Tested-by: Shawn Meredith <shawn@instructure.com>
2013-05-31 05:25:34 +00:00
Shawn Meredith e1cb5465aa simplecov update
Change-Id: Ie61a2ec6d9f460b1cc7f448e3d658c8c552675b5
Reviewed-on: https://gerrit.instructure.com/21064
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Shawn Meredith <shawn@instructure.com>
Product-Review: Shawn Meredith <shawn@instructure.com>
QA-Review: Shawn Meredith <shawn@instructure.com>
2013-05-31 05:01:55 +00:00
Shawn Meredith e3c113c640 simplecov implementation
Change-Id: I8528b62abce60e25777f5c5210c6e38a6d809455
Reviewed-on: https://gerrit.instructure.com/20882
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>
2013-05-30 17:30:45 +00:00
Brad Humphrey 6b3274a095 sessionless launch of LTI tools
test plan:
 * add an external tool to each of:
   - context module item
   - course navigation (tabs)
   - assignment
 * exercise the index methods for each API
 * ensure a url is returned for each external tool
   - this url should be to the sessionless launch API
 * query the sessionless launch API with the url
   - this call will return another url which allows a launch of the LTI tool in a browser not logged into Canvas
 * copy/paste the url into a browser that is not logged into Canvas (incognito)
 * ensure the LTI tool launches correctly

fixes #CNVS-5854

Change-Id: I6b50f965f4714e7efb9cfe0f99e1cd0b5f2055f2
Reviewed-on: https://gerrit.instructure.com/20868
QA-Review: Clare Strong <clare@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-05-25 00:06:39 +00:00
Stanley Stuart 5ad43c33bd add ability to download all file uploads for a quiz as a zip
test plan:
  - as a few different students, take a quiz with at least two questions
    that are file upload questions. Answer each question as each
    student.
  - as the teacher, you should see a "Download All Files" button on the
    right on the Quiz Show Page next to "Quiz Stastics" and "Moderate
    This Quiz".
  - You should get a pop up that successfully downloads all the zips
    (make sure you have delayed jobs running!). Make sure all the files
    you submitted as the students are there, with the student's name,
    user id, question number, and attachment display name in the
    filename of each file.

closes CNVS-3048

Change-Id: I23cb2d4262bb0446476eeac4fdcb356e604e6a05
Reviewed-on: https://gerrit.instructure.com/20495
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Eric Berry <ericb@instructure.com>
Product-Review: Stanley Stuart <stanley@instructure.com>
2013-05-16 21:14:19 +00:00
Brian Palmer 31f33164b5 remove 1.8 compatibility shims
- update the Gemfile to be 1.9 only, and raise an exception on wrong
  ruby version
- remove RUBY_VERSION checks, replacing with the applicable code
- remove the FasterCSV compatibility shim, just use CSV now

test plan: trying to bundle install on ruby 1.8 or 2.0 should raise an
exception, specs should pass, canvas should work as normal on 1.9

Change-Id: I49088e9d227c59c6d5d5acb417c2df971129474a
Reviewed-on: https://gerrit.instructure.com/19806
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2013-05-03 01:43:52 +00:00
Jon Willesen d8efd3e805 improve robustness of incoming message processor
replaced the mailman gem with custom code with more error
handling. this will allow the incoming message processor to
continue processing messages after encountering a message with
an encoding or parsing error. the broken messages will be moved
aside to a separate folder for later inspection.

fixes CNVS-4970

test plan:
 - read up on the new incoming_mail.yml configuration settings.
 - configure incoming_mail.yml with the test imap accounts
   using legacy settings and check for regressions.
 - reconfigure incoming_mail.yml to read from a directory.
 - copy some testing email files into the configured directory.
   test files should be a mix of:
   - emails with encoding errors
   - emails with syntax errors
   - normal emails
 - all of the normal emails should be processed normally
 - all of the error emails should be moved into the error
   subdirectory

Change-Id: I0f946a56b41492f007db2775aa6da3cdfa4fdd3f
Reviewed-on: https://gerrit.instructure.com/19729
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-04-29 14:47:09 +00:00
Mark Severson 26a4204b87 fix failing specs (caused by libxml2 upgrade)
test plan:
 * specs pass

Change-Id: I2041fa39cbabfd11a51de5aae28d611cacb280e5
refs: #CNVS-5269
Reviewed-on: https://gerrit.instructure.com/19687
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
2013-04-18 16:29:44 +00:00
Mark Ericksen 828b42ce30 ui enabling admins to search notifications
adds account setting and new user permission

fixes CNVS-4726

Testing Notes:
============
* To enable...
  * Account Settings, check Feature
    "Admins can view notifications"
  * Account permission under "Account Roles"
    becomes available under "Admin Tools"
    group. Check "View notifications"
  * appears under account "Admin Tools"
    sidebar area on "View Notifications"
    tab.
    (EX: /accounts/[account_id]/admin_tools)
* Verify "View Notifications" tab does not
  appear if either account setting or user
  permission is disabled. (For AccountAdmins)
* Verify a SiteAdmin is able to access the
  feature.
* Verify that notifications are returned
  and displayed for a selected user
  and date range.
* Verify it displays "No messages found"
  when user doesn't exist or the user
  exists but the date range doesn't
  return data.
* Verify that the user_id is required when
  searching
* Verify that the "To Date" cannot be before
  the "From Date".
* Verify an invalid date like the word "couch"
  gets ignored and the actually used date/time
  is displayed in the overview text description.
* Verify searching by dates when either or both
  are left blank and when both are used.
* Verify that the messages automatically
  fetch more when you scroll down.
* Verify that before the results, it displays
  the user's name and the dates used for the
  results.

Change-Id: I9d2689b4760af57bbc2d15fd7d50610dcf593a7e
Reviewed-on: https://gerrit.instructure.com/18629
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
2013-04-16 22:11:16 +00:00
Brian Palmer a9d33591c2 get rspec 2 running with rails 3.0
Not passing, just running

for example spec/models: 2511 examples, 2322 failures, 2 pending

refs CNVS-4711

Change-Id: If744731cf801c47349d2ae49daf43874ae9309dd
Reviewed-on: https://gerrit.instructure.com/18893
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2013-03-27 15:41:28 +00:00
Brian Palmer cb5e957965 start adding rails 3.0 support
This can successfully load rails console and rails server. There are
many, many problems still. The idea is this won't change anything under
rails 2.3, it's all backwards compatible.

closes CNVS-4711

test plan: `touch RAILS3` in your Canvas Rails.root directory. The run
`bundle update` and verify that you get rails 3 installed. Run `bundle
exec rails c` to load console or `bundle exec rails s` to start a
webrick server. You can login, though the dashboard currently breaks.
Also jammit isn't working yet.

But more importantly, Rails 2.3 should still work same as ever. All
tests should pass, and a basic regression sanity check would be good too.

Change-Id: Idd6f35de88adde84cd2db3a650f44b71bd6e9684
Reviewed-on: https://gerrit.instructure.com/18453
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-03-22 19:08:40 +00:00
Jacob Fugal 3399c417a2 spec: kill enable_jobs{} helper
the implementation was rife with potential race conditions, and active
records query cache doesn't play nicely with threading.

Change-Id: I0e1c3d5cc05ad78e2f91f304490e6a1b5a925ab2
Reviewed-on: https://gerrit.instructure.com/18880
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2013-03-21 23:47:12 +00:00
Cody Cutrer 25e8d5fdba spec: avoid before(:all) where possible
they're prone to leaving junk around, don't allow parallel specs
on the same database, and are typically slower anyway if you do
the "right" thing and truncate_all_tables in an after all

Change-Id: I2455e5c0de98c75e3748ce7fc2caf6d04a150a44
Reviewed-on: https://gerrit.instructure.com/18684
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
2013-03-18 17:04:46 -06:00
James Williams 5f470c69ac add File.expand_path for ruby version compatibility
code fix, no test plan

Change-Id: Iff01e6523fb7d77a84d8e9829c5efbb2a5306a51
Reviewed-on: https://gerrit.instructure.com/18622
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Bracken Mosbacker <bracken@instructure.com>
2013-03-18 12:25:14 -06:00
Cody Cutrer 4954ecd803 spec: fix attachments not being found when duplicated
the dynamic attachment_fu backend changing overwrote Attachment#attachment_path_id
with a custom method to dynamically delegate to the backend. detect such methods,
and leave them alone

test plan:
 * `spec spec/apis/v1/course_api_spec.rb spec/apis/v1/sis_imports_api_spec.rb`
   should pass

Change-Id: I6cad3c9bbc4edfca7ab64bb4ffe239d50dde8cdf
Reviewed-on: https://gerrit.instructure.com/18685
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-03-18 12:09:49 -06:00
Cody Cutrer fec3ae76a7 more aggressively set context on page views
fixes CNVS-4455

you can never have too much context

also, apparently this is the first integration spec that uses the
API from a session (not an access token), so fix API forgery
protection to respect the allow_forgery_protection option
(what's set for specs to not have to worry about forgery
protection), and clean up enabling of it in specs to use
stubbing

test plan:
 * do an action that counts as participating, but wasn't a GET
   (i.e. comment on a discussion)
 * you should see a page view for the user in that course

Change-Id: I8714de45575123d6877e0265623e0fcaf9e7fa58
Reviewed-on: https://gerrit.instructure.com/18504
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-03-14 17:38:20 -06:00
Cody Cutrer dbd79b7343 spec: fix VDD timestampy spec
Change-Id: I4a33904e48810c98850c763ba33c817232cb8e83
Reviewed-on: https://gerrit.instructure.com/18598
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-03-14 10:21:51 -06:00
Cody Cutrer 40309819b7 upgrade mocha
Change-Id: I2209531a3bfaf68932455dc9a1eb2471067b754f
Reviewed-on: https://gerrit.instructure.com/18550
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-03-12 17:55:53 -06:00
Cody Cutrer b843f68a38 upgrade attachment_fu to use aws-sdk gem instead of aws-s3
closes CNVS-4248

this gains us EU region support, and no longer using a forked aws-s3 gem

in the process, setting bucket_name via a plugin is no longer supported

test plan:
 * should be able to upload new files via various methods
 * should be able to download old and new files still

Change-Id: If32fa5f381f5a4ac493948fa32230175a695f51e
Reviewed-on: https://gerrit.instructure.com/18282
QA-Review: Clare Hetherington <clare@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2013-03-11 15:55:58 -06:00
Cody Cutrer 22d0c053af change attachment backends dynamically for specs
removes the need to fork/exec (and reboot rails) for specs;
also simplifies forcing a specific backend for specs

note that path_prefix in file_store.yml is now respected for
S3 as well (so that parallel spec runs that use the same bucket
don't conflict with each other), with the caveat that 'tmp/files'
is special cased to be backwards compatible for S3, and change
to 'attachments'

test plan:
 * specs pass (especially selenium specs involving files)

Change-Id: I9673d454291062c958c2989788d36339ce60dfc4
Reviewed-on: https://gerrit.instructure.com/18292
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
2013-03-11 15:55:49 -06:00
Brian Palmer 77ca8ac013 remove deprecated rails constant usage
basically convert RAILS_ROOT -> Rails.root , RAILS_ENV -> Rails.env ,
RAILS_DEFAULT_LOGGER -> Rails.logger

This is necessary for rails 3

Change-Id: I138e1aa217fa8fb186d23ac09b04031c1e2b665e
Reviewed-on: https://gerrit.instructure.com/18412
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Eric Berry <ericb@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-03-11 12:14:08 -06:00
Duane Johnson e847c0a24e strip bad UTF8 byte seqs from versioned quiz submissions
Test Plan:
  - with an existing quiz submission with bad UTF8 byte sequences,
    update the quiz submission
  - no errors should be raised and the version of the quiz submission
    should be updated

fixes CNVS-4421

Change-Id: I5288021a3b400a0bd59c4d70437ef737058bec18
Reviewed-on: https://gerrit.instructure.com/18346
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-03-11 11:30:39 -06:00
Stanley Stuart 49f952b1d5 make fancy midnight work for assignment overrides
also fixes an issue where some dates display as "Friday at 11:59pm" instead
of just "Friday"

Also does a little bit of refactoring and spec backfilling for the
override list presenter. The override list presenter now returns a much
more friendly list of "due date" hashes to the outside world to make it
easier to consume in views. Views don't have to format the dates by
passing in a hash anymore.

test plan:
  - specs should pass
  - as a teacher, create an assignment with overrides using the web
    form. In one of the overrides, enter a day like March 1 at 12am.
  - save the overrides
  - Make sure fancy midnight works for lock dates and due dates, but not
    unlock dates (12:00 am unlock date should show up as 12:00 am, not
    11:59 pm)
  - on the assignment's show page, you should just see "Friday", meaning
    that the assignment is due at 11:59 pm on March 1.
  - The "fancy midnight" scheme should work correctly for
    assignments,quizzes,and discussion topics, including the default due
    dates.
  - Be sure to check that the dates show up correctly on the
    assignment,quiz, and discussion show pages.
  - Be sure to make an override that has a blank due_at, lock_at, and
    unlock_at, but has a default due date, lock date, and unlock date.
    The overrides should not inherit from the default due date (fixes
    CNVS-4216)

fixes CNVS-4216, CNVS-4004, CNVS-3890

Change-Id: I8b5e10c074eb2a237a1298cb7def0cb32d3dcb7f
Reviewed-on: https://gerrit.instructure.com/18142
QA-Review: Amber Taniuchi <amber@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2013-03-07 15:53:06 -07:00
Eric Berry 1f2fed44b9 calendar event with > 58 chars title truncated in undated list
when an undated event is created on caledar2 month view with a very
long name, the name will be truncated in the undated list and will
retain the truncation when dragging the event to a date.

fixes CNVS-1256

test steps:
- create a new course
- go to calendar2
- create an undated event with a title that is > 58 charactes
- ensure that the event on the right hand side is truncated
- click and drag the event out to a date and ensure the name is
  truncated

Change-Id: I94b36736d87acd7d5afb8501bfa78d02f182d2b9
Reviewed-on: https://gerrit.instructure.com/18210
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-03-06 15:07:04 -07:00
Jacob Fugal c85d02f944 fix grouping and common context id interpretation
in messageable users. if a user has multiple enrollments in a course,
don't return multiple MessageableUser rows. also, make sure
interpretation of shard-local common context ids occur relative to the
shard the row comes from.

refs CNVS-3969

test-plan:
 - create a course (course1)
 - create a user (user1) that's enrolled multiple times course1 (e.g. as
   a TA in one section and a student in another)
 - create another user (user2) in course1 that can see both of the first
   user's enrollments (e.g. a teacher without section-limited
   visibility)
 - call user2.messageable_users_in_context(course.global_asset_string)
 - the result should contain user1
 - the result should contain user1 only once
 - the result for user1 should have both roles in the common_courses

Change-Id: Ic8ce5f07e5ce3a0d56998da0876d12333d97f6e6
Reviewed-on: https://gerrit.instructure.com/18238
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-03-06 13:50:09 -07:00
Stanley Stuart 1ca24e39e2 specs: always reset the i18n locale to :en
fixes a race condition issue where some tests were being set to the
wrong locale.

test plan:
  - specs pass
  - make a spec that changes the global locale (there are several
    already that exist it seems). Run that spec, then run another spec
    asserting that the locale is "en" again, rather than the locale you
    set.

Change-Id: I3f925f1b59e7d8c975398429824432ab9c94ef86
Reviewed-on: https://gerrit.instructure.com/18153
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
2013-02-28 09:23:59 -07:00
Simon Williams 9dea044ec3 spec: removed unused constant
Change-Id: I4a2e3cd5ceb9a48bb9a4bf836265f5d58135764c
Reviewed-on: https://gerrit.instructure.com/17846
Reviewed-by: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-02-19 09:40:38 -07:00
Jacob Fugal b27b4984fa spec: fix some spec helpers for sharding
* creating a new course(...) puts the Course on the shard for the
   target account (default: Account.default). if it creates a new
   teacher, that will also be on the course's shard

 * creating a new account_admin_user(...) puts the AccountUser on the
   target account's shard. if it creates a new user, that will also be
   on the account's shard

 * if a new course_with_user(...) creates a new user, put the user on
   the same shard as the course

Change-Id: I3b9675fa0a6d4fd3793bf2a38a7c7accdacd987f
Reviewed-on: https://gerrit.instructure.com/17568
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2013-02-08 14:18:26 -07:00
Duane Johnson 6f1ec3403b refactor google_docs_specs and remove remote dependence
In anticipation of adding a faster google docs listing, first
refactor the specs.

Test Plan:
  - google docs should behave as before

refs CNVS-3592

Change-Id: Ic62d0cd170f491b5f36f516c0a71fde367dab0b2
Reviewed-on: https://gerrit.instructure.com/17548
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-02-08 12:56:35 -07:00
Brian Palmer d7bac4a190 fix for a ruby 1.9 warning message
Backported from ruby 2.0 (and possibly later 1.9 patchlevels) because it
was filling our logs with many millions of warnings. The code was
backported directly, the test was backported with conversion from
minitest -> rspec.

test plan: Delayed jobs that use ruby's net libraries should still work,
such as sending messages, taking web snapshots, etc. You shouldn't see
any further lines like this in the log:

net/protocol.rb:313: warning: regexp match /.../n against to UTF-8 string

Change-Id: Ic29daa4ee9f0587fb2a1ac2968cd08a2f68365a1
Reviewed-on: https://gerrit.instructure.com/17431
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2013-02-05 08:32:30 -07:00
Cody Cutrer e8e81deb5b Cross-shard conversations
fixes CNVS-1171

test plan:
 * full conversations regression test
 * initiate a conversation with a user from another shard
 * reply to that conversation from both the sender and the
   receiver
 * repeat for a group conversation involving two or more
   shards
 * repeat for huge batch conversations with hundreds of
   users and two or more shards
 * known NOT working yet:
   * re-using the correct cross-shard private conversation
   * probably the tagging of messages with Course x,
     Group y, etc.

Change-Id: I52549039875941cd518077cea4e28bfd2bc10dbf
Reviewed-on: https://gerrit.instructure.com/16523
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-01-31 17:11:48 -07:00
Brian Palmer ee80c2bb7a spec: clear attachment domain_namespace before each spec
This fixes some failures that happen depending on spec ordering

Also fix a selenium spec bug that was trying to turn an Announcement
into an assignment discussion.

Change-Id: Ic252844ae348642ea66f02cfedbd735d1eeb1d53
Reviewed-on: https://gerrit.instructure.com/16582
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
2013-01-07 16:08:18 -07:00