-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_discountcurves_api.py
More file actions
40 lines (31 loc) · 1.75 KB
/
test_discountcurves_api.py
File metadata and controls
40 lines (31 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import unittest
import sys
from fds.analyticsapi.engines.api.discount_curves_api import DiscountCurvesApi
from fds.analyticsapi.engines.model.fi_discount_curve_info_root import FIDiscountCurveInfoRoot
from common_functions import CommonFunctions
class TestDiscountCurvesApi(unittest.TestCase):
def setUp(self):
self.discount_curves_api = DiscountCurvesApi(CommonFunctions.build_api_client())
def test_get_all_discount_curves(self):
response = self.discount_curves_api.get_all_fi_discount_curves()
currency_code = list(response[0].data.keys())[0]
self.assertEqual(response[1], 200, "Response should be 200 - Success")
self.assertEqual(type(response[0].data), dict,
"Response should be of Dictionary type.")
self.assertGreater(
len(response[0].data), 0, "Response result should not be an empty list.")
def test_get_all_discount_curves_currency_usd(self):
response = self.discount_curves_api.get_all_fi_discount_curves(currency = "INR")
currency_code = list(response[0].data.keys())[0]
self.assertEqual(response[1], 200, "Response should be 200 - Success")
self.assertEqual(type(response[0].data), dict,
"Response should be of Dictionary type.")
self.assertGreater(
len(response[0].data), 0, "Response result should not be an empty list.")
def test_get_all_discount_curves_currency_invalid_currency(self):
try:
self.discount_curves_api.get_all_fi_discount_curves(currency = "invalidcurrency")
except Exception as e:
self.assertEqual(type(e).__name__, "NotFoundException", "Response should be 404 - Not Found")
if __name__ == '__main__':
unittest.main()