|
26 | 26 | import base64 |
27 | 27 | import sys |
28 | 28 | import os |
29 | | -from datetime import datetime |
| 29 | +import datetime |
30 | 30 |
|
31 | 31 | from cloudant import cloudant, couchdb, couchdb_admin_party |
32 | 32 | from cloudant.client import Cloudant, CouchDB |
@@ -471,17 +471,19 @@ def test_billing_data(self): |
471 | 471 | """ |
472 | 472 | try: |
473 | 473 | self.client.connect() |
| 474 | + now = datetime.datetime.now() |
474 | 475 | expected = [ |
475 | 476 | 'data_volume', |
476 | 477 | 'total', |
477 | 478 | 'start', |
478 | 479 | 'end', |
479 | 480 | 'http_heavy', |
480 | | - 'http_light' |
| 481 | + 'http_light', |
| 482 | + 'bill_type' |
481 | 483 | ] |
482 | 484 | # Test using year and month |
483 | | - year = 2016 |
484 | | - month = 1 |
| 485 | + year = now.year |
| 486 | + month = now.month |
485 | 487 | data = self.client.bill(year, month) |
486 | 488 | self.assertTrue(all(x in expected for x in data.keys())) |
487 | 489 | #Test without year and month arguments |
@@ -563,15 +565,16 @@ def test_volume_usage_data(self): |
563 | 565 | """ |
564 | 566 | try: |
565 | 567 | self.client.connect() |
| 568 | + now = datetime.datetime.now() |
566 | 569 | expected = [ |
567 | 570 | 'data_vol', |
568 | 571 | 'granularity', |
569 | 572 | 'start', |
570 | 573 | 'end' |
571 | 574 | ] |
572 | 575 | # Test using year and month |
573 | | - year = 2016 |
574 | | - month = 12 |
| 576 | + year = now.year |
| 577 | + month = now.month |
575 | 578 | data = self.client.volume_usage(year, month) |
576 | 579 | self.assertTrue(all(x in expected for x in data.keys())) |
577 | 580 | #Test without year and month arguments |
@@ -653,15 +656,16 @@ def test_requests_usage_data(self): |
653 | 656 | """ |
654 | 657 | try: |
655 | 658 | self.client.connect() |
| 659 | + now = datetime.datetime.now() |
656 | 660 | expected = [ |
657 | 661 | 'requests', |
658 | 662 | 'granularity', |
659 | 663 | 'start', |
660 | 664 | 'end' |
661 | 665 | ] |
662 | 666 | # Test using year and month |
663 | | - year = 2016 |
664 | | - month = 1 |
| 667 | + year = now.year |
| 668 | + month = now.month |
665 | 669 | data = self.client.requests_usage(year, month) |
666 | 670 | self.assertTrue(all(x in expected for x in data.keys())) |
667 | 671 | #Test without year and month arguments |
|
0 commit comments