Beispiel #1
0
    def json_with_error_block_raises_exception_test(self):

        def callback(resource, api_version, query_params):
            return json.loads('{"errors": "foo"}')
        connection = MockConnection(callback)
        l = Loans(connection)

        with self.assertRaises(ExecutionFailureException):
            l.listed_loans()
Beispiel #2
0
    def json_with_error_block_raises_exception_test(self):
        def callback(resource, api_version, query_params):
            return json.loads('{"errors": "foo"}')

        connection = MockConnection(callback)
        l = Loans(connection)

        with self.assertRaises(ExecutionFailureException):
            l.listed_loans()
Beispiel #3
0
    def verify_asOfDate_datetime_converted_test(self):
        def callback(resource, api_version, query_params):
            return VALID_RESPONSE

        connection = MockConnection(callback)
        l = Loans(connection)

        result = l.listed_loans()

        self.assertEqual(arrow.get("2014-09-03T14:41:53.959-07:00"),
                         result['asOfDate'])
Beispiel #4
0
    def verify_asOfDate_datetime_converted_test(self):

        def callback(resource, api_version, query_params):
            return VALID_RESPONSE

        connection = MockConnection(callback)
        l = Loans(connection)

        result = l.listed_loans()

        self.assertEqual(arrow.get("2014-09-03T14:41:53.959-07:00"),
                         result['asOfDate'])
Beispiel #5
0
    def verify_loan_datetimes_converted_test(self):
        def callback(resource, api_version, query_params):
            return VALID_RESPONSE

        dates = {}
        dates["acceptD"] = arrow.get("2014-08-25T10:56:29.000-07:00")
        dates["expD"] = arrow.get("2014-09-08T10:57:13.000-07:00")
        dates["listD"] = arrow.get("2014-08-25T10:50:20.000-07:00")
        dates["creditPullD"] = arrow.get("2014-08-25T10:56:18.000-07:00")
        dates["reviewStatusD"] = arrow.get("2014-09-03T14:41:53.957-07:00")
        dates["ilsExpD"] = arrow.get("2014-08-25T11:00:00.000-07:00")
        dates["earliestCrLine"] = arrow.get("1984-09-15T00:00:00.000-07:00")

        connection = MockConnection(callback)
        l = Loans(connection)

        loan = l.listed_loans()['loans'][0]

        for date in dates:
            self.assertEqual(dates[date], loan[date])
Beispiel #6
0
    def correctly_passes_showAll_param_test(self):
        showAllValue = False

        def callback(resource, api_version, query_params):
            self.assertIsNotNone(query_params)
            self.assertTrue('showAll' in query_params)
            self.assertEqual(showAllValue, query_params['showAll'])
            return VALID_RESPONSE
        connection = MockConnection(callback)
        l = Loans(connection)

        l.listed_loans()
        l.listed_loans(get_all_loans=False)
        showAllValue = True
        l.listed_loans(get_all_loans=True)
Beispiel #7
0
    def verify_loan_datetimes_converted_test(self):

        def callback(resource, api_version, query_params):
            return VALID_RESPONSE

        dates = {}
        dates["acceptD"] = arrow.get("2014-08-25T10:56:29.000-07:00")
        dates["expD"] = arrow.get("2014-09-08T10:57:13.000-07:00")
        dates["listD"] = arrow.get("2014-08-25T10:50:20.000-07:00")
        dates["creditPullD"] = arrow.get("2014-08-25T10:56:18.000-07:00")
        dates["reviewStatusD"] = arrow.get("2014-09-03T14:41:53.957-07:00")
        dates["ilsExpD"] = arrow.get("2014-08-25T11:00:00.000-07:00")
        dates["earliestCrLine"] = arrow.get("1984-09-15T00:00:00.000-07:00")

        connection = MockConnection(callback)
        l = Loans(connection)

        loan = l.listed_loans()['loans'][0]

        for date in dates:
            self.assertEqual(dates[date], loan[date])
Beispiel #8
0
    def correctly_passes_showAll_param_test(self):
        showAllValue = False

        def callback(resource, api_version, query_params):
            self.assertIsNotNone(query_params)
            self.assertTrue('showAll' in query_params)
            self.assertEqual(showAllValue, query_params['showAll'])
            return VALID_RESPONSE

        connection = MockConnection(callback)
        l = Loans(connection)

        l.listed_loans()
        l.listed_loans(get_all_loans=False)
        showAllValue = True
        l.listed_loans(get_all_loans=True)