File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,11 +41,20 @@ def test_initialization(self):
4141 for key in keys :
4242 self .assertTrue (key in self .config .keys )
4343
44- def test_init_environment (self ):
44+ def test_init_environment_should_set_env_from_dotenv (self ):
4545 config_file = sendgrid .helpers .inbound .config .__file__
4646 env_file_path = os .path .abspath (os .path .dirname (config_file )) + '/.env'
4747 with open (env_file_path , 'w' ) as f :
4848 f .write ('RANDOM_VARIABLE=RANDOM_VALUE' )
4949 Config ()
5050 os .remove (env_file_path )
5151 self .assertEqual ('RANDOM_VALUE' , os .environ ['RANDOM_VARIABLE' ])
52+
53+ def test_init_environment_should_not_set_env_if_format_is_invalid (self ):
54+ config_file = sendgrid .helpers .inbound .config .__file__
55+ env_file_path = os .path .abspath (os .path .dirname (config_file )) + '/.env'
56+ with open (env_file_path , 'w' ) as f :
57+ f .write ('RANDOM_VARIABLE=RANDOM_VALUE=ANOTHER_RANDOM_VALUE' )
58+ Config ()
59+ os .remove (env_file_path )
60+ self .assertIsNone (os .environ .get ('RANDOM_VARIABLE' ))
You can’t perform that action at this time.
0 commit comments