You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

33 lines
1017 B

  1. import unittest
  2. import os
  3. import kosmorrolib.core as core
  4. class CoreTestCase(unittest.TestCase):
  5. def test_flatten_list(self):
  6. self.assertEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], core.flatten_list([0, 1, 2, [3, 4, [5, 6], 7], 8, [9]]))
  7. def test_get_env(self):
  8. self.assertEqual(0, len(core.get_env()))
  9. os.environ['SOME_RANDOM_VAR'] = 'an awesome value'
  10. self.assertEqual(0, len(core.get_env()))
  11. os.environ['KOSMORRO_GREAT_VARIABLE'] = 'value'
  12. env = core.get_env()
  13. self.assertEqual(1, len(env))
  14. self.assertEqual('value', env.great_variable)
  15. os.environ['KOSMORRO_ANOTHER_VARIABLE'] = 'another value'
  16. env = core.get_env()
  17. self.assertEqual(2, len(env))
  18. self.assertEqual('value', env.great_variable)
  19. self.assertEqual('another value', env.another_variable)
  20. self.assertEqual("{'great_variable': 'value', 'another_variable': 'another value'}", str(env))
  21. if __name__ == '__main__':
  22. unittest.main()