def test_file_exists_json_is_loaded(self): self.assertIsNone(os.environ.get(self.ENVIRONMENT_VARIABLE)) self.create_environment_json_file('foo') loadenv() self.assertEqual(os.environ.get(self.ENVIRONMENT_VARIABLE), 'foo')
def test_file_overwrites_existing_value(self): os.environ[self.ENVIRONMENT_VARIABLE] = 'bar' self.assertEqual(os.environ.get(self.ENVIRONMENT_VARIABLE), 'bar') self.create_environment_json_file('baz') loadenv() self.assertEqual(os.environ.get(self.ENVIRONMENT_VARIABLE), 'baz')
def test_no_file_environment_variable_not_set(self): self.assertIsNone(os.environ.get(self.ENVIRONMENT_VARIABLE)) loadenv() self.assertIsNone(os.environ.get(self.ENVIRONMENT_VARIABLE))