예제 #1
0
파일: account_test.py 프로젝트: mxmn/pylend
 def init_raises_exception_with_bad_params_test(self):
     with self.assertRaises(ValueError):
         Account(None, None)
     with self.assertRaises(ValueError):
         Account(self.connection, None)
     with self.assertRaises(ValueError):
         Account(None, 1)
예제 #2
0
파일: account_test.py 프로젝트: mxmn/pylend
    def valid_result_raises_no_exceptions_test(self):
        def callback(resource, api_version, query_params):
            return json.loads(self.__VALID_RESULT)

        connection = MockConnection(callback)
        a = Account(connection, 1)

        a.pending_transfers()
예제 #3
0
파일: account_test.py 프로젝트: mxmn/pylend
    def json_with_error_block_raises_exception_test(self):
        def callback(resource, api_version, query_params):
            return json.loads("""{"errors": "foo"}""")

        connection = MockConnection(callback)
        a = Account(connection, 1)

        with self.assertRaises(ExecutionFailureException):
            a.account_summary()
예제 #4
0
파일: account_test.py 프로젝트: mxmn/pylend
    def detailed_info_requests_data_from_detailednotes_test(self):
        def callback(resource, api_version, query_params):
            self.assertEquals('accounts/1/detailednotes', resource)
            return json.loads(self.__VALID_RESULT)

        connection = MockConnection(callback)
        a = Account(connection, 1)

        a.owned_notes(detailed_info=True)
예제 #5
0
파일: account_test.py 프로젝트: mxmn/pylend
    def null_enddate_is_not_converted_test(self):
        def callback(resource, api_version, query_params):
            return json.loads(self.__VALID_RESULT)

        connection = MockConnection(callback)
        a = Account(connection, 1)

        result = a.pending_transfers()

        self.assertIsNone(result[0]['endDate'])
예제 #6
0
파일: account_test.py 프로젝트: mxmn/pylend
    def dates_are_converted_test(self):
        def callback(resource, api_version, query_params):
            return json.loads(self.__VALID_RESULT)

        connection = MockConnection(callback)
        a = Account(connection, 1)

        result = a.owned_notes()
        self.assertEquals(arrow.get("2009-11-12T06:34:02.000-08:00"),
                          result[0]['issueDate'])
예제 #7
0
파일: account_test.py 프로젝트: mxmn/pylend
    def no_portfolios_returns_empty_list_test(self):
        def callback(resource, api_version, query_params):
            return json.loads('{}')

        connection = MockConnection(callback)
        a = Account(connection, 1)

        result = a.portfolios()

        self.assertEquals(list, type(result))
        self.assertEquals(0, len(result))
예제 #8
0
파일: account_test.py 프로젝트: mxmn/pylend
    def frequencies_are_converted_test(self):
        def callback(resource, api_version, query_params):
            return json.loads(self.__VALID_RESULT)

        connection = MockConnection(callback)
        a = Account(connection, 1)

        result = a.pending_transfers()

        self.assertEquals("LOAD_ONCE", result[0]['frequency'])
        self.assertEquals("LOAD_ON_DAY_1_AND_16", result[3]['frequency'])
예제 #9
0
파일: account_test.py 프로젝트: mxmn/pylend
 def init_succeeds_with_good_params_test(self):
     Account(self.connection, 1)