ansible/test/units
Sam Doran 719c40bfdf
[stable-2.10] facts - fix incorrect time for some date_time_facts (#70665) (#70996)
* [stable-2.10] facts - fix incorrect time for some date_time_facts (#70665)

The iso8601_micro and iso8601 facts incorrectly called now.utcnow(), resulting
in a new timestamp at the time it was called, not a conversion of the previously
stored timestamp.

Correct this by capturing the UTC timestamp once then calculating the local
time using the UTC offset of the current system.

* Use time.time() for getting the current time
* Convert from that stored epoch timestamp to local and UTC times
* Used existing timestamp for epoch time
* Add unit tests that validate the formate of the return value rather than an exact value since mocking time and timezone is non-trivial
(cherry picked from commit c4f442ed5a)

Co-authored-by: Sam Doran <sdoran@redhat.com>

* Remove tests for tz_dst since that only exists in newer versions
2020-07-30 13:37:19 -07:00
..
_vendor transparent downstream vendoring (#69850) 2020-06-15 16:22:25 -07:00
ansible_test Add Azure Pipelines support to ansible-test. 2020-06-11 14:57:42 -07:00
cli ansible-galaxy - fix collection installation with trailing slashes (#70016) 2020-06-15 17:36:07 -04:00
compat
config [stable-2.10] Clean up unit test boilerplate. 2020-07-13 18:28:02 -07:00
errors Remove empty overridden unittest.setUp and unittest.tearDown methods. 2019-11-05 09:12:11 -08:00
executor fix internal cases of actions calling unqualified module names (#70818) (#70840) 2020-07-23 10:29:09 -07:00
galaxy [2.10] Improve ansible-galaxy STDOUT messages for collections (#70379) 2020-07-17 12:39:16 -07:00
inventory [stable-2.10] Clean up unit test boilerplate. 2020-07-13 18:28:02 -07:00
inventory_test_data/group_vars
mock [stable-2.10] Clean up unit test boilerplate. 2020-07-13 18:28:02 -07:00
module_utils [stable-2.10] facts - fix incorrect time for some date_time_facts (#70665) (#70996) 2020-07-30 13:37:19 -07:00
modules [stable-2.10] Clean up unit test boilerplate. 2020-07-13 18:28:02 -07:00
parsing [stable-2.10] Ensure single vaulted values aren't counted as sequences. Fixes #70784 (#70786) (#70791) 2020-07-22 18:25:38 -07:00
playbook [stable-2.10] Clean up unit test boilerplate. 2020-07-13 18:28:02 -07:00
plugins fix internal cases of actions calling unqualified module names (#70818) (#70840) 2020-07-23 10:29:09 -07:00
regex
template Do not treat AnsibleUndefined as being unsafe (#65202) 2019-11-25 15:06:29 +01:00
utils reset logging to INFO (#70878) (#70881) 2020-07-24 15:47:57 -05:00
vars Remove empty setUp/tearDown/tearDownClass methods in test classes. 2019-11-06 08:14:29 -08:00
__init__.py
requirements.txt Remove unnecessary unit test requirements. 2020-03-23 11:14:21 -05:00
test_constants.py [stable-2.10] Clean up unit test boilerplate. 2020-07-13 18:28:02 -07:00
test_context.py [stable-2.10] Clean up unit test boilerplate. 2020-07-13 18:28:02 -07:00