Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit ef163a7

Browse files
committed
Updated billing tests
Added `bill_type` field to expected. Used datetime to get current month/year since there is no guarantee that we will have historical billing data for the account being used to test. Added bill_type
1 parent cc47724 commit ef163a7

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

tests/unit/client_tests.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import base64
2727
import sys
2828
import os
29-
from datetime import datetime
29+
import datetime
3030

3131
from cloudant import cloudant, couchdb, couchdb_admin_party
3232
from cloudant.client import Cloudant, CouchDB
@@ -471,17 +471,19 @@ def test_billing_data(self):
471471
"""
472472
try:
473473
self.client.connect()
474+
now = datetime.datetime.now()
474475
expected = [
475476
'data_volume',
476477
'total',
477478
'start',
478479
'end',
479480
'http_heavy',
480-
'http_light'
481+
'http_light',
482+
'bill_type'
481483
]
482484
# Test using year and month
483-
year = 2016
484-
month = 1
485+
year = now.year
486+
month = now.month
485487
data = self.client.bill(year, month)
486488
self.assertTrue(all(x in expected for x in data.keys()))
487489
#Test without year and month arguments
@@ -563,15 +565,16 @@ def test_volume_usage_data(self):
563565
"""
564566
try:
565567
self.client.connect()
568+
now = datetime.datetime.now()
566569
expected = [
567570
'data_vol',
568571
'granularity',
569572
'start',
570573
'end'
571574
]
572575
# Test using year and month
573-
year = 2016
574-
month = 12
576+
year = now.year
577+
month = now.month
575578
data = self.client.volume_usage(year, month)
576579
self.assertTrue(all(x in expected for x in data.keys()))
577580
#Test without year and month arguments
@@ -653,15 +656,16 @@ def test_requests_usage_data(self):
653656
"""
654657
try:
655658
self.client.connect()
659+
now = datetime.datetime.now()
656660
expected = [
657661
'requests',
658662
'granularity',
659663
'start',
660664
'end'
661665
]
662666
# Test using year and month
663-
year = 2016
664-
month = 1
667+
year = now.year
668+
month = now.month
665669
data = self.client.requests_usage(year, month)
666670
self.assertTrue(all(x in expected for x in data.keys()))
667671
#Test without year and month arguments

0 commit comments

Comments
 (0)