def testSetValues(self): """ This method tests :meth:`foundations.environment.Environment.setValues` method. """ environment = Environment() self.assertTrue(environment.setValues(JOHN="DOE")) self.assertIn("JOHN", os.environ) self.assertTrue(environment.setValues(JOHN="EOD", DOE="JOHN")) self.assertIn("DOE", os.environ) self.assertEqual(environment.getValues()["JOHN"], "EOD")
def testSetValues(self): """ Tests :meth:`foundations.environment.Environment.setValues` method. """ environment = Environment() self.assertTrue(environment.setValues(JOHN="DOE")) self.assertIn("JOHN", os.environ) self.assertTrue(environment.setValues(JOHN="EOD", DOE="JOHN")) self.assertIn("DOE", os.environ) self.assertEqual(environment.getValues()["JOHN"], "EOD")
def testGetValue(self): """ Tests :meth:`foundations.environment.Environment.getValue` method. """ if platform.system() == "Windows" or platform.system() == "Microsoft": environment = Environment("APPDATA") elif platform.system() == "Darwin": environment = Environment("HOME") elif platform.system() == "Linux": environment = Environment("HOME") self.assertTrue(environment.getValue()) self.assertIsInstance(environment.getValue(), unicode) environment.setValues(JOHN="DOE") self.assertEqual(environment.getValue("JOHN"), "DOE") self.assertFalse(environment.getValue("JOHNDOE_IS_FOR_SURE_A_NON_EXISTING_SYSTEM_ENVIRONMENT_VARIABLE"))
def testGetValue(self): """ This method tests :meth:`foundations.environment.Environment.getValue` method. """ if platform.system() == "Windows" or platform.system() == "Microsoft": environment = Environment("APPDATA") elif platform.system() == "Darwin": environment = Environment("HOME") elif platform.system() == "Linux": environment = Environment("HOME") self.assertTrue(environment.getValue()) self.assertIsInstance(environment.getValue(), str) environment.setValues(JOHN="DOE") self.assertEqual(environment.getValue("JOHN"), "DOE") self.assertFalse( environment.getValue( "JOHNDOE_IS_FOR_SURE_A_NON_EXISTING_SYSTEM_ENVIRONMENT_VARIABLE" ))