Ejemplo n.º 1
0
    def test_issue_fund(self):
        fund_name = "基金一号"
        # 正确发行基金测试
        status_code, response_dict = issue_fund(self.bank_teller_token,
                                                fund_name, '2021-3-20', 3.2)
        self.assertEqual(200, status_code)
        self.assertEqual("issue fund success", response_dict['msg'])

        # 无柜员权限测试
        status_code, response_dict = issue_fund("wrong token", fund_name,
                                                '2021-3-20', 3.2)
        self.assertEqual(401, status_code)
        self.assertEqual("Unauthorized", response_dict)

        # 参数缺失测试
        status_code, response_dict = issue_fund(self.bank_teller_token,
                                                fund_name, '2021-3-20')
        self.assertEqual(400, status_code)
        self.assertEqual(EM_INVALID_OR_MISSING_PARAMETERS, response_dict)

        # 参数错误测试
        status_code, response_dict = issue_fund(self.bank_teller_token,
                                                fund_name, '2021-3-20', -1)
        self.assertEqual(400, status_code)
        self.assertEqual(EM_INVALID_OR_MISSING_PARAMETERS, response_dict)

        # 基金重名测试
        status_code, response_dict = issue_fund(self.bank_teller_token,
                                                fund_name, '2021-3-20', 3.2)
        self.assertEqual(400, status_code)
        self.assertEqual(EM_PRODUCT_NAME_USED, response_dict)
    def setUp(self):
        self.client = Client()
        sys_register("投资查询测试", "imbus123", "柜员", "13966667777")

        status_code, response_dict = sys_login("投资查询测试", "imbus123")
        self.bank_teller_token = response_dict['token']

        status_code, response_dict = add_customer(self.bank_teller_token,
                                                  "客户一", "13100006789",
                                                  "330888855590001",
                                                  10000000.0)
        self.customer_id = response_dict["customer_id"]

        status_code, response_dict = issue_fund(self.bank_teller_token, "基金一号",
                                                '2021-3-20', 3.0)
        fund_id = response_dict['fund_id']

        buy_fund(self.bank_teller_token, self.customer_id, fund_id, 700,
                 "2021-3-21", 100)

        status_code, response_dict = issue_stock(self.bank_teller_token,
                                                 "浦发银行", '2021-3-20', 15)
        stock_id = response_dict['stock_id']

        buy_stock(self.bank_teller_token, self.customer_id, stock_id, 200,
                  "2021-3-21")

        status_code, response_dict = issue_regular_deposit(
            self.bank_teller_token, "定期理财一号", '2021-3-20', 9, 0.07)
        regular_deposit_id = response_dict['regular_deposit_id']

        buy_regular_deposit(self.bank_teller_token, self.customer_id,
                            regular_deposit_id, 100, "2021-3-21")
Ejemplo n.º 3
0
    def setUp(self):
        self.client = Client()
        sys_register("实体类测试", "imbus123", "柜员", "13966667777")

        status_code, response_dict = sys_login("实体类测试", "imbus123")
        bank_teller_token = response_dict['token']

        status_code, response_dict = issue_fund(bank_teller_token, "基金一号",
                                                '2021-3-20', 3.2)
        self.fund_id = response_dict['fund_id']

        status_code, response_dict = issue_stock(bank_teller_token, "招商银行",
                                                 '2021-3-30', 15)
        self.stock_id = response_dict['stock_id']
Ejemplo n.º 4
0
    def setUp(self):
        self.client = Client()
        sys_register("投资市场测试", "imbus123", "柜员", "13966667777")

        status_code, response_dict = sys_login("投资市场测试", "imbus123")
        self.bank_teller_token = response_dict['token']

        status_code, response_dict = issue_fund(self.bank_teller_token, "基金二号",
                                                '2021-3-20', 3.2)
        self.fund_id = response_dict['fund_id']

        status_code, response_dict = issue_stock(self.bank_teller_token,
                                                 "招商银行", '2021-3-30', 15)
        self.stock_id = response_dict['stock_id']

        status_code, response_dict = issue_regular_deposit(
            self.bank_teller_token, "定期理财二号", '2021-3-9', 9, 0.07)
        self.regular_deposit_id = response_dict['regular_deposit_id']