Skip to content

Commit

Permalink
Token Technical Documentation R5
Browse files Browse the repository at this point in the history
  • Loading branch information
MBAustin committed Nov 8, 2016
1 parent f648a19 commit ff45a84
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion TestFramework.md
Expand Up @@ -139,7 +139,7 @@ At the very end of `process_test_form` (`line 161`), the assignment's token para
### As student -> Assignment -> Austomated Testing
This is where students **spend tokens** to run tests. Code for this page: [views/automated_tests/student_interface.html.erb](app/views/automated_tests/student_interface.html.erb)

Clicking "Run Tests" calls `execute_test_run`: [controllers/automated_tests_controller.rb](app/controllers/automated_tests_controller.rb)(`line 92`), which retrieves the current user/group's tokens for the assignment through `fetch_latest_tokens_for_grouping`: [helpers/automated_tests_client_helper.rb](app/helpers/automated_tests_client_helper.rb)(`line 10`). This method first **ensures that the current group has an associated token object, then calls this token object's `reassign_tokens` method: [models/token.rb](app/models/token.rb)(`line 32`), which handles the DateTime math for regenerating tokens to **determine how many the group should currently have**.
Clicking "Run Tests" calls `execute_test_run`: [controllers/automated_tests_controller.rb](app/controllers/automated_tests_controller.rb)(`line 92`), which retrieves the current user/group's tokens for the assignment through `fetch_latest_tokens_for_grouping`: [helpers/automated_tests_client_helper.rb](app/helpers/automated_tests_client_helper.rb)(`line 10`). This method first **ensures that the current group has an associated token object**, then calls this token object's `reassign_tokens` method: [models/token.rb](app/models/token.rb)(`line 32`), which handles the DateTime math for regenerating tokens to **determine how many the group should currently have**.

If the current group has tokens remaining, `execute_test_run` calls `run_tests` (defined directly below), which in turn calls `request_a_test_run`: [helpers/automated_tests_client_helper.rb](app/helpers/automated_tests_client_helper.rb)(`line 36`), which calls `check_user_permission`(line 215), which calls the current token's `decrease_tokens`: [models/token.rb](app/models/token.rb)(`line 22`) to **decrement the number of tokens** remaining, and **makes sure the last used time is set properly**.

Expand Down

0 comments on commit ff45a84

Please sign in to comment.