@@ -15,6 +15,7 @@ This project is designed to provide a blueprint to allow for development teams t
1515 - [ Configuration] ( #configuration )
1616 - [ Getting Started] ( #getting-started )
1717 - [ Utilities] ( #utilities )
18+ - [ Using Environment Variables For Secrets] ( #using-environment-variables-for-secrets )
1819 - [ Contributing] ( #contributing )
1920 - [ Contacts] ( #contacts )
2021 - [ Licence] ( #licence )
@@ -71,14 +72,42 @@ For additional reading and guidance on writing tests, we also recommend reviewin
7172
7273## Utilities
7374
74- This blueprint also provides the following utility classes, that can be used to aid in testing:
75+ This blueprint provides the following utility classes, that can be used to aid in testing:
7576
76- | Utility| Description|
77- | -------| -----------|
78- | [ Axe] ( ./docs/utility-guides/Axe.md ) | Accessibility scanning using axe-core.|
79- | [ Date Time Utility] ( ./docs/utility-guides/DateTimeUtility.md ) | Basic functionality for managing date/times.|
80- | [ NHSNumberTools] ( ./docs/utility-guides/NHSNumberTools.md ) | Basic tools for working with NHS numbers.|
81- | [ User Tools] ( ./docs/utility-guides/UserTools.md ) | Basic user management tool.|
77+ | Utility | Description |
78+ | ------------------------------------------------------------- | -------------------------------------------- |
79+ | [ Axe] ( ./docs/utility-guides/Axe.md ) | Accessibility scanning using axe-core. |
80+ | [ Date Time Utility] ( ./docs/utility-guides/DateTimeUtility.md ) | Basic functionality for managing date/times. |
81+ | [ NHSNumberTools] ( ./docs/utility-guides/NHSNumberTools.md ) | Basic tools for working with NHS numbers. |
82+ | [ User Tools] ( ./docs/utility-guides/UserTools.md ) | Basic user management tool. |
83+
84+ ## Using Environment Variables For Secrets
85+
86+ This blueprint provides functionality for saving secret / sensitive values that you would not want present
87+ in the codebase, but require to execute tests locally (such as passwords or API keys). A local.env file can
88+ be generated by running the [ following script] ( ./setup_env_file.py ) :
89+
90+ ``` shell
91+ python ./setup_env_file.py
92+ ```
93+
94+ This script file is design to be amended / updated as your project evolves, so as more sensitive values are required
95+ for executing tests, the list of keys provided can be updated so for subsequent runs of the script, all the expected
96+ keys are populated within the local.env file (which will need their values setting manually). The intent is that this
97+ script can be run to onboard new team members and provide a local file with all the variables they need to populate.
98+
99+ The local.env file (if present), is read at the start of any test session (via the [ conftest.py file] ( ./conftest.py ) )
100+ and any variables can be accessed by using the Python os library like so:
101+
102+ # Import the OS library
103+ import os
104+
105+ # Access environment variable
106+ os.getenv('<key_from_local.env>')
107+
108+ The local.env file is set in the [ .gitignore file] ( ./.gitignore ) , so by default it will not commit if amended.
109+
110+ > NOTE: You should never commit this file or any secrets in the codebase directly.
82111
83112## Contributing
84113
0 commit comments