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
1.1 KiB

  1. import unittest
  2. from kosmorrolib.data import AsterEphemerides, Planet
  3. from kosmorrolib.dumper import JsonDumper
  4. class DumperTestCase(unittest.TestCase):
  5. def test_json_dumper_returns_correct_json(self):
  6. data = self._get_data()
  7. self.assertEqual('{\n'
  8. ' "moon_phase": "FULL_MOON",\n'
  9. ' "details": [\n'
  10. ' {\n'
  11. ' "name": "Mars",\n'
  12. ' "ephemerides": {\n'
  13. ' "rise_time": null,\n'
  14. ' "culmination_time": null,\n'
  15. ' "set_time": null\n'
  16. ' }\n'
  17. ' }\n'
  18. ' ]\n'
  19. '}', JsonDumper(data).to_string())
  20. @staticmethod
  21. def _get_data():
  22. return {
  23. 'moon_phase': 'FULL_MOON',
  24. 'details': [Planet('Mars', 'MARS', AsterEphemerides(None, None, None))]
  25. }
  26. if __name__ == '__main__':
  27. unittest.main()