Rocket/core/lib/tests
Sergio Benitez 4e06ee64aa Test 'secret_key' validation, now on pre-launch.
Prior to this commit, it was not possible to test Rocket crates in
production mode without setting a global secret key or bypassing secret
key checking - the testing script did the latter. The consequence is
that it became impossible to test secret key related failures because
the tests passed regardless.

This commit undoes this. As a consequence, all tests are now aware of
the difference between debug and release configurations, the latter of
which validates 'secret_key' by default. New 'Client::debug()' and
'Client::debug_with()' simplify creating an instance of 'Client' with
configuration in debug mode to avoid undesired test failures.

The summary of changes in this commit are:

  * Config 'secret_key' success and failure are now tested.
  * 'secret_key' validation was moved to pre-launch from 'Config:from()'.
  * 'Config::from()' only extracts the config.
  * Added 'Config::try_from()' for non-panicking extraction.
  * 'Config' now knows the profile it was extracted from.
  * The 'Config' provider sets a profile of 'Config.profile'.
  * 'Rocket', 'Client', 'Fairings', implement 'Debug'.
  * 'fairing::Info' implements 'Copy', 'Clone'.
  * 'Fairings' keeps track of, logs attach fairings.
  * 'Rocket::reconfigure()' was added to allow modifying a config.

Internally, the testing script was refactored to properly test the
codebase with the new changes. In particular, it no longer sets a rustc
'cfg' to avoid secret-key checking.

Resolves #1543.
Fixes #1564.
2021-03-09 21:57:26 -08:00
..
absolute-uris-okay-issue-443.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
attach-inspect.rs Remove 'rocket::inspect()', 'Cargo'. 2020-10-22 03:27:04 -07:00
catcher-cookies-1213.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
conditionally-set-server-header-996.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
config-secret-key-1500.rs Remove 'Config::profile()'. CFG 'secret_key' field. 2021-03-09 21:40:53 -08:00
derive-reexports.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
encoded-uris.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
fairing_before_head_strip-issue-546.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
flash-lazy-removes-issue-466.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
form-validation-names.rs UTF-8 routes. Forms revamp. Temp files. Capped. 2021-03-04 01:51:21 -08:00
form_method-issue-45.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
form_value_decoding-issue-82.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
form_value_from_encoded_str-issue-1425.rs UTF-8 routes. Forms revamp. Temp files. Capped. 2021-03-04 01:51:21 -08:00
head_handling.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
limits.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
local-client-access-runtime-in-drop.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
local-request-content-type-issue-505.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
local_request_private_cookie-issue-368.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
many-cookie-jars-at-once.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
mapped-base-issue-1262.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
mount_point.rs Migrate core to Rust 2018. 2019-06-25 13:45:23 -04:00
nested-fairing-attaches.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
on_launch_fairing_can_inspect_port.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
panic-handling.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
precise-content-type-matching.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
redirect_from_catcher-issue-113.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
replace-content-type-518.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
responder_lifetime-issue-345.rs Remove use of stable 'proc_macro_hygiene' feature. 2020-07-11 10:48:08 -07:00
route_guard.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
segments-issues-41-86.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
session-cookies-issue-1506.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
strict_and_lenient_forms.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
timer-on-attach.rs Update to 'tokio' 1.0, 'hyper' 0.14. 2021-01-13 15:22:16 -08:00
tls-config-from-source-1503.rs Add regression test for #1503. 2021-01-14 15:15:57 -08:00
twice_managed_state.rs Remove 'rocket::inspect()', 'Cargo'. 2020-10-22 03:27:04 -07:00
typed-uri-docs-redef-issue-1373.rs Generate 'uri!' macro names independently of span. 2020-07-14 00:44:59 -07:00
unsound-local-request-1312.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
untracked-vs-tracked.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
uri-percent-encoding-issue-808.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00