Skip to content

Commit 3d413be

Browse files
more test coverage for t he utils classes
1 parent 59db251 commit 3d413be

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

tests/CLI/core_tests.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
class CoreTests(testing.TestCase):
2020

2121
def test_load_all(self):
22-
for path, cmd in recursive_subcommand_loader(core.cli,
23-
current_path='root'):
22+
for path, cmd in recursive_subcommand_loader(core.cli, current_path='root'):
2423
try:
2524
cmd.main(args=['--help'])
2625
except SystemExit as ex:

tests/basic_tests.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
66
:license: MIT, see LICENSE for more details.
77
"""
8+
import datetime
89
import SoftLayer
910
from SoftLayer import testing
1011

@@ -59,6 +60,25 @@ def test_query_filter(self):
5960
result = SoftLayer.utils.query_filter(10)
6061
self.assertEqual({'operation': 10}, result)
6162

63+
def test_query_filter_date(self):
64+
result = SoftLayer.utils.query_filter_date("2018-01-01", "2018-01-02")
65+
expected = {
66+
'operation': 'betweenDate',
67+
'options': [
68+
{'name': 'startDate', 'value': ['1/1/2018 0:0:0']},
69+
{'name': 'endDate', 'value': ['1/2/2018 0:0:0']}
70+
]
71+
}
72+
self.assertEqual(expected, result)
73+
74+
def test_timezone(self):
75+
utc = SoftLayer.utils.UTC()
76+
time = datetime.datetime(2018, 1, 1, tzinfo=utc)
77+
self.assertEqual('2018-01-01 00:00:00+00:00', time.__str__())
78+
self.assertEqual('UTC', time.tzname())
79+
self.assertEqual(datetime.timedelta(0), time.dst())
80+
self.assertEqual(datetime.timedelta(0), time.utcoffset())
81+
6282

6383
class TestNestedDict(testing.TestCase):
6484

0 commit comments

Comments
 (0)