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.

преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/usr/bin/env python3
  2. from .utils import (
  3. execute,
  4. KOSMORRO,
  5. )
  6. def check_command_return_t_plus_one(result):
  7. assert result.is_successful()
  8. assert (
  9. result.stdout
  10. == """Monday, January 27, 2020
  11. Moon phase: New Moon
  12. First Quarter on Sunday, February 2, 2020 at 2:41 AM
  13. Expected events:
  14. 9:00 PM Venus and Neptune are in conjunction
  15. Note: All the hours are given in the UTC+1 timezone.
  16. """
  17. )
  18. def check_command_return_t_minus_one(result):
  19. assert result.is_successful()
  20. assert (
  21. result.stdout
  22. == """Monday, January 27, 2020
  23. Moon phase: New Moon
  24. First Quarter on Sunday, February 2, 2020 at 12:41 AM
  25. Expected events:
  26. 7:00 PM Venus and Neptune are in conjunction
  27. Note: All the hours are given in the UTC-1 timezone.
  28. """
  29. )
  30. def test_timezone():
  31. check_command_return_t_plus_one(
  32. execute(KOSMORRO + ["--timezone=1", "-d2020-01-27"])
  33. )
  34. check_command_return_t_minus_one(
  35. execute(KOSMORRO + ["--timezone=-1", "-d2020-01-27"])
  36. )
  37. def test_timezone_with_env_var():
  38. check_command_return_t_plus_one(
  39. execute(KOSMORRO + ["-d2020-01-27"], environment={"KOSMORRO_TIMEZONE": "1"})
  40. )
  41. check_command_return_t_minus_one(
  42. execute(KOSMORRO + ["-d2020-01-27"], environment={"KOSMORRO_TIMEZONE": "-1"})
  43. )
  44. # If both environment variable and argument are set, use argument:
  45. check_command_return_t_plus_one(
  46. execute(
  47. KOSMORRO + ["--timezone=1", "-d2020-01-27"],
  48. environment={"KOSMORRO_TIMEZONE": "-1"},
  49. )
  50. )
  51. check_command_return_t_minus_one(
  52. execute(
  53. KOSMORRO + ["--timezone=-1", "-d2020-01-27"],
  54. environment={"KOSMORRO_TIMEZONE": "1"},
  55. )
  56. )