Example #1
0
    def test_qr_code(self):
        """
        检查返回正确的qr二维码
        """

        # get login token
        api_login = config.get_url("Login")
        request_sign_in = ConfigRequest()
        data = {
            "mobile": config.get_login("Mobile"),
            "valid": config.get_login("Valid")
        }
        request_sign_in.set_data(data)
        request_sign_in.set_url(api_login)
        response_sign_in = request_sign_in.post()
        self.assertNotEqual(response_sign_in, None)
        self.assertNotEqual(response_sign_in.get("token"), None)

        # get qr code
        api_qr_code = config.get_url("QR_Code")
        token = response_sign_in.get("token")
        headers = {"Authorization": "Bearer {}".format(token)}
        request_qr_code = ConfigRequest()
        request_qr_code.set_headers(headers)
        request_qr_code.set_url(api_qr_code)
        response_qr_code = request_qr_code.get()
        self.assertGreater(len(response_qr_code.get("qr_code")), 2566)
        self.assertEqual(len(response_qr_code.get("invitation")), 6)
    def test_logout(self):
        """
        检查可以正确退出
        """
        mobile = config.get_login("Mobile")
        valid = config.get_login("Valid")

        api_in = config.get_url("Login")
        api_out = config.get_url("Logout")
        request_in = ConfigRequest()
        request_in.set_url(api_in)
        request_in.set_data({"mobile":mobile, "valid": valid})
        response = request_in.post()

        authorization = response.get('token')

        request_out = ConfigRequest()
        request_out.set_url(api_out)
        request_out.set_headers({"Authorization": "Bearer " + authorization})
        response = request_out.get()

        logger.info("Bearer " + authorization)
        logger.info(response)

        self.assertEqual(response.get("code"), 0)
Example #3
0
    def test_rankings_change(self):
        api = config.get_url("homepage_sort")
        request = ConfigRequest()
        l_sort_direction = ["asc", "desc"]
        l_sort_item = [
            "cmc_volume_usd", "chain_new_user_count_7day",
            "git_commit_count_7day", "git_commit_count_30day",
            "git_contributor_count", "market_cap_usd", "twitter_follower_count"
        ]

        for direction in l_sort_direction:
            for item in l_sort_item:
                params = {
                    "skip": 0,
                    "limit": 20,
                    "sort": "{} {}".format(item, direction)
                }
                request.set_url(api)
                request.set_params(params)
                response = request.get()

                # return 20 tokens
                self.assertEqual(len(response), 20)
                for token in response:
                    self.assertNotEqual(token.get("name"), None)
                    self.assertNotEqual(token.get("name_abbr"), None)
                    self.assertNotEqual(token.get("cmc_market_cap_usd"), None)
                    self.assertNotEqual(token.get("cmc_price_usd"), None)
                    self.assertNotEqual(token.get("cmc_volume_usd"), None)
Example #4
0
    def test_token_candle(self):
        """
        测试K线接口
        """
        request = ConfigRequest()
        request.set_url(test_url.format('Bitcoin', '1d'))
        response = request.get()

        self.assertIsInstance(response, list)
        self.assertGreater(len(response), 0)

        for item in response:
            self.assertIsInstance(item, list)
            self.assertEqual(len(item), 17)
            # time
            self.assertIsInstance(item[0], int)
            self.assertGreater(item[0], 0)
            # open
            self.assertIn(type(item[1]), [float, int])
            self.assertGreater(item[1], 0)
            # close
            self.assertIn(type(item[2]), [float, int])
            self.assertGreater(item[2], 0)
            # low
            self.assertIn(type(item[3]), [float, int])
            self.assertGreater(item[3], 0)
            # high
            self.assertIn(type(item[4]), [float, int])
            self.assertGreater(item[4], 0)
Example #5
0
    def rankings_change(self, url):

        request = ConfigRequest()
        request.set_url(url)

        # Descending
        request.set_params({"sort": "desc", "limit": 10})
        response = request.get()

        # return 10 tokens
        self.assertEqual(len(response), 10)
        for token in response:
            self.assertNotEqual(token.get("cmc_change_ratio"), None)
            self.assertNotEqual(token.get("cmc_price_usd"), None)
            self.assertNotEqual(token.get("name"), None)

        # Ascending
        request.set_params({"sort": "asc", "limit": 10})
        response = request.get()

        # return 10 tokens
        self.assertEqual(len(response), 10)
        for token in response:
            self.assertNotEqual(token.get("cmc_change_ratio"), None)
            self.assertNotEqual(token.get("cmc_price_usd"), None)
            self.assertNotEqual(token.get("name"), None)
    def test_candle(self):
        """
        测试K线接口
        """
        request = ConfigRequest()
        request.set_url(test_url)
        response = request.get()

        self.assertIsInstance(response, list)
        self.assertGreaterEqual(len(response), 0)
        for item in response:
            self.assertIsInstance(item, list)
            self.assertGreaterEqual(len(item), 15)
            # time
            self.assertIsInstance(item[0], int)
            self.assertGreater(item[0], 0)
            # open
            self.assertIn(type(item[1]), [float, int])
            self.assertGreater(item[1], 0)
            # close
            self.assertIn(type(item[2]), [float, int])
            self.assertGreater(item[2], 0)
            # high
            self.assertIn(type(item[3]), [float, int])
            self.assertGreater(item[3], 0)
            # low
            self.assertIn(type(item[4]), [float, int])
            self.assertGreater(item[4], 0)
            # volume
            self.assertIn(type(item[5]), [float, int])
            self.assertGreaterEqual(item[5], 0)
Example #7
0
    def test_symbol_list(self):
        """
        测试交易对首页接口
        """
        request = ConfigRequest()
        request.set_url(test_url)
        response = request.get()

        self.assertIsInstance(response, dict)
        self.assertIn('indicators', response)
        self.assertIsInstance(response['indicators'], list)
        self.assertGreater(len(response['indicators']), 0)
        for item in response['indicators']:
            self.assertIsInstance(item, dict)
            self.assertEqual(len(item), 18)
            # code
            self.assertIn('code', item)
            self.assertIsInstance(item['code'], str)
            self.assertNotEqual(item['code'], '')
            # name
            self.assertIn('name', item)
            self.assertIsInstance(item['name'], str)
            self.assertNotEqual(item['name'], '')
            # name_cn
            self.assertIn('name_cn', item)
            # name_en
            self.assertIn('name_en', item)
            self.assertIsInstance(item['name_en'], str)
            self.assertNotEqual(item['name_en'], '')
            # name_abbr
            self.assertIn('name_abbr', item)
            self.assertIsInstance(item['name_abbr'], str)
            self.assertNotEqual(item['name_abbr'], '')
Example #8
0
    def test_get(self):
        """
        检查返回正确的token数据
        """

        request = ConfigRequest()
        languages = ["cn", "en"]
        ONE_HOUR = 3600

        for lang in languages:
            params = {"lang": lang}
            request.set_params(params)
            request.set_url(news_api)
            response = request.get()

            tokens_amount = len(response)
            self.assertEqual(tokens_amount, 50)
            last_news_time = response[0].get("create_time")
            last_news_time = datetime.datetime.strptime(
                last_news_time, "%Y-%m-%dT%H:%M:%S.%fZ")
            now = datetime.datetime.utcnow()
            timedelta = now - last_news_time

            # The last news was updated recently
            print("Last news was updated at {}, now {}".format(
                last_news_time, now))
            self.assertLess(timedelta.seconds, ONE_HOUR)
Example #9
0
    def test_amount_of_return_data(self):
        """
        检查可以正确返回货币的个数
        """

        request = ConfigRequest()
        request.set_url(market_cap_ratio_api)
        response = request.get()

        self.assertEqual(len(response), 10)
Example #10
0
    def test_data_field(self):
        """
        检查所有的字段都不为空
        """

        request = ConfigRequest()
        request.set_url(market_cap_ratio_api)
        response = request.get()

        for item in response:
            self.assertNotEqual(item.get("name"), None)
            self.assertNotEqual(item.get("name"), "")
    def test_f10_links(self):
        """
        测试f10基本信息接口links
        """
        request = ConfigRequest()
        request.set_url(test_url.format('Bitcoin'))
        response = request.get()

        self.assertIsInstance(response, dict)
        self.assertEqual(len(response), 14)
        # bitcointalk
        self.assertIn('bitcointalk', response)
        self.assertIsInstance(response['bitcointalk'], list)
        # explorer
        self.assertIn('explorer', response)
        self.assertIsInstance(response['explorer'], list)
        # facebook
        self.assertIn('facebook', response)
        self.assertIsInstance(response['facebook'], list)
        # forum
        self.assertIn('forum', response)
        self.assertIsInstance(response['forum'], list)
        # github
        self.assertIn('github', response)
        self.assertIsInstance(response['github'], list)
        # telegram
        self.assertIn('telegram', response)
        self.assertIsInstance(response['telegram'], list)
        # twitter
        self.assertIn('twitter', response)
        self.assertIsInstance(response['twitter'], list)
        # website
        self.assertIn('website', response)
        self.assertIsInstance(response['website'], list)
        # wechat
        self.assertIn('wechat', response)
        self.assertIsInstance(response['wechat'], list)
        # whitepaper
        self.assertIn('whitepaper', response)
        self.assertIsInstance(response['whitepaper'], list)
        # coinmarketcap
        self.assertIn('coinmarketcap', response)
        self.assertIsInstance(response['coinmarketcap'], list)
        # feixiaohao
        self.assertIn('feixiaohao', response)
        self.assertIsInstance(response['feixiaohao'], list)
        # reddit
        self.assertIn('reddit', response)
        self.assertIsInstance(response['reddit'], list)
        # block
        self.assertIn('block', response)
        self.assertIsInstance(response['block'], list)
Example #12
0
    def test_rankings_volume_24h(self):
        api = "/api/v1/home/ranking/volume_24h"
        request = ConfigRequest()
        request.set_url(api)

        request.set_params({"sort": "desc", "limit": 10})
        response = request.get()

        # return 10 tokens
        self.assertEqual(len(response), 10)
        for token in response:
            self.assertNotEqual(token.get("cmc_volume_usd"), None)
            self.assertNotEqual(token.get("name"), None)
Example #13
0
    def test_invalid_cellphone_no(self):
        """
        非法手机号无法发送验证码
        """
        cellphone = "186" + ''.join(
            [str(i) for i in random.sample(range(10), 7)])
        post = ConfigRequest()
        post.set_url(valid_api)
        post.set_data({"mobile": cellphone})
        response = post.post()

        logger.info(response)
        self.assertNotEqual(response.get("code"), 0)
Example #14
0
    def test_send(self):
        """
            检查可以正确发送验证码
        """

        cellphone = "186" + ''.join(
            [str(i) for i in random.sample(range(10), 8)])
        post = ConfigRequest()
        post.set_url(valid_api)
        post.set_data({"mobile": cellphone})
        response = post.post()

        self.assertEqual(response.get("code"), 0)
    def test_examine(self):
        """
        检查返回正确examine结果
        """

        # get login token
        api_login = config.get_url("Login")
        request_sign_in = ConfigRequest()
        data = {
            "mobile": config.get_login("Mobile"),
            "valid": config.get_login("Valid")
        }
        request_sign_in.set_data(data)
        request_sign_in.set_url(api_login)
        response_sign_in = request_sign_in.post()
        self.assertNotEqual(response_sign_in, None)
        self.assertNotEqual(response_sign_in.get("token"), None)

        # get examine result
        api_examine = config.get_url("examine")
        token = response_sign_in.get("token")
        headers = {"Authorization": "Bearer {}".format(token)}
        params_examine = {"type": "examine"}
        params_share = {"type": "share"}

        request_examine = ConfigRequest()
        request_examine.set_headers(headers)
        request_examine.set_params(params_share)
        request_examine.set_url(api_examine)
        response_examine = request_examine.get()

        count = response_examine.get("examine_status").get("count")

        # Ur examine count will add 1 time if u share
        request_examine.get()
        request_examine.get()
        response_examine = request_examine.get()
        count += 3
        self.assertEqual(
            response_examine.get("examine_status").get("count"), count)

        # ur examine count will reduce 1 time if u examine
        for c in range(1, count + 1):
            request_examine = ConfigRequest()
            request_examine.set_headers(headers)
            request_examine.set_params(params_examine)
            request_examine.set_url(api_examine)
            response_examine = request_examine.get()
            self.assertEqual(
                response_examine.get("examine_status").get("count"), count - c)
            self.assertEqual(response_examine.get("hasExamine"), True)

        request_examine = ConfigRequest()
        request_examine.set_headers(headers)
        request_examine.set_params(params_examine)
        request_examine.set_url(api_examine)
        response_examine = request_examine.get()
        self.assertEqual(
            response_examine.get("examine_status").get("count"), 0)
        self.assertEqual(response_examine.get("hasExamine"), False)
    def test_get(self):
        """
        检查返回正确的token数据
        """

        request = ConfigRequest()
        request.set_url(all_token_api)
        response = request.get()

        tokens_amount = len(response)
        self.assertGreater(tokens_amount, 1400)
        for token in response:
            self.assertNotEqual(token.get("name"), None)
            self.assertNotEqual(token.get("name_en"), None)
Example #17
0
    def test_points_management(self):
        """
        检查积分管理接口
        """

        # get login token
        api_login = config.get_url("Login")
        request_sign_in = ConfigRequest()
        data = {
            "mobile": config.get_login("Mobile"),
            "valid": config.get_login("Valid")
        }
        request_sign_in.set_data(data)
        request_sign_in.set_url(api_login)
        response_sign_in = request_sign_in.post()
        self.assertNotEqual(response_sign_in, None)
        self.assertNotEqual(response_sign_in.get("token"), None)

        d_type_enum = {
            'register': 0,
            'bindWeChat': 888,  # 绑定we Chat
            'invitation': 2000,  # 邀请用户积分
            'effective': 2000,  # 有效用户积分
            'shareNews': 80,  # 分享积分
            'shareFocus': 80,  # 分享脱壳关注
            'shareCoin': 80,  # 分享币体检
            'shareWeChat': 80,  # 微信 qq二维码 链接分享 分享统一的注册地址
            'shareToken': 80,  # 币种分享
            'shareMarket': 80,  # 交易对分享
        }

        api_points_management = config.get_url("points_management")
        token = response_sign_in.get("token")
        headers = {"Authorization": "Bearer {}".format(token)}

        for type_get_point in d_type_enum:
            self.reset_point_and_point_status_shared_count()
            request_share = ConfigRequest()
            request_share.set_url(api_points_management)
            request_share.set_headers(headers)
            request_share.set_data({"type": type_get_point})
            response = request_share.post()
            self.assertEqual(
                response.get("data").get("point"),
                d_type_enum.get(type_get_point))
            self.assertEqual(
                response.get("data").get("point_status_shared").get("count"),
                1)
Example #18
0
    def test_data(self):
        """
        检查返回数据的正确性
        """

        db_bcf = BcfMongo()
        request = ConfigRequest()
        request.set_url(market_cap_ratio_api)
        response = request.get()

        first_cap_coin = response[0]
        first_cap_coin_code = first_cap_coin.get("code")
        first_cap_coin_cap = first_cap_coin.get("cmc_market_cap_usd")

        btc_cap = db_bcf.get_cmc_indicators_with_code("Bitcoin",
                                                      "cmc_market_cap_usd")

        self.assertEqual(first_cap_coin_code, "Bitcoin")
        self.assertEqual(first_cap_coin_cap, btc_cap)
Example #19
0
    def test_my_points(self):
        """
        检查返回正确用户积分信息
        """

        # get login token
        api_login = config.get_url("Login")
        request_sign_in = ConfigRequest()
        data = {
            "mobile": config.get_login("Mobile"),
            "valid": config.get_login("Valid")
        }
        request_sign_in.set_data(data)
        request_sign_in.set_url(api_login)
        response_sign_in = request_sign_in.post()
        self.assertNotEqual(response_sign_in, None)
        self.assertNotEqual(response_sign_in.get("token"), None)

        # get examine result
        api_my_points = config.get_url("my_points")
        token = response_sign_in.get("token")
        headers = {"Authorization": "Bearer {}".format(token)}

        request = ConfigRequest()
        request.set_headers(headers)
        request.set_url(api_my_points)
        response = request.get()

        # get user infomation from mongodb
        bcf = BcfMongo()
        user_info = bcf.get_user_info(data.get("mobile"))
        self.assertEqual(response.get("mobile"), user_info.get("mobile"))
        self.assertEqual(response.get("invitation"),
                         user_info.get("invitation"))
        self.assertEqual(response.get("point"), user_info.get("point"))
        self.assertEqual(type(response.get("invitationCoun")), int)
        self.assertEqual(type(response.get("effectiveCoun")), int)
        self.assertEqual(type(response.get("invitationScore")), int)
        self.assertEqual(type(response.get("effectctiveScore")), int)
        self.assertEqual(
            requests.get(response.get("regiserURL")).status_code, 200)
Example #20
0
    def test_token_candle(self):
        """
        测试新闻接口
        """
        request = ConfigRequest()
        request.set_url(test_url.format('Bitcoin'))
        response = request.get()

        self.assertIsInstance(response, list)
        self.assertGreater(len(response), 0)

        for item in response:
            self.assertIsInstance(item, dict)
            self.assertEqual(len(item), 7)
            # new_id
            self.assertIn('news_id', item)
            self.assertIsInstance(item['news_id'], str)
            self.assertGreater(len(item['news_id']), 0)
            # source_time
            self.assertIn('source_time', item)
            self.assertIsInstance(item['source_time'], str)
            self.assertGreater(len(item['source_time']), 0)
            # create_time
            self.assertIn('create_time', item)
            self.assertIsInstance(item['create_time'], str)
            self.assertGreater(len(item['create_time']), 0)
            # title
            self.assertIn('title', item)
            self.assertIsInstance(item['title'], str)
            # content
            self.assertIn('content', item)
            self.assertIsInstance(item['content'], str)
            self.assertGreater(len(item['content']), 0)
            # language
            self.assertIn('language', item)
            self.assertIsInstance(item['language'], str)
            # self.assertIn(item['language'], ['zh-cn',''])
            # link
            self.assertIn('link', item)
            self.assertIsInstance(item['link'], str)
    def test_login(self):
        """
        检查可以正确登录
        """

        mobile = config.get_login("Mobile")
        valid = config.get_login("Valid")
        ts = time.time()

        api = config.get_url("Login")
        request = ConfigRequest()
        request.set_url(api)
        request.set_data({"mobile":mobile, "valid": valid})
        response = request.post()
        self.token = response.get('token')



        self.assertEqual(response.get("code"), 0)
        # 7天后过期
        self.assertAlmostEqual(response.get("exp"), ts + 7*24*60*60, delta=10)
        # token长度
        self.assertIn(len(response.get('token')), [i for i  in range(100, 256)])
Example #22
0
    def test_symbol_detail(self):
        """
        测试交易对详情接口
        """
        request = ConfigRequest()
        request.set_url(test_url.format('huobipro', 'btc-usdt'))
        response = request.get()

        self.assertIsInstance(response, dict)
        self.assertGreaterEqual(len(response), 0)

        # market
        self.assertIn('market', response)
        self.assertIsInstance(response['market'], str)
        self.assertGreater(len(response['market']), 0)
        # symbol
        self.assertIn('symbol', response)
        self.assertIsInstance(response['symbol'], str)
        self.assertGreater(len(response['symbol']), 0)
        # time
        self.assertIn('time', response)
        self.assertIsInstance(response['time'], int)
        self.assertGreater(response['time'], 0)
        # update_time
        self.assertIn('update_time', response)
        self.assertIsInstance(response['update_time'], int)
        self.assertGreater(response['update_time'], 0)
        # open
        self.assertIn('open', response)
        self.assertIn(type(response['open']), [float, int])
        self.assertGreater(response['open'], 0)
        # close
        self.assertIn('close', response)
        self.assertIn(type(response['close']), [float, int])
        self.assertGreater(response['close'], 0)
        # high
        self.assertIn('high', response)
        self.assertIn(type(response['high']), [float, int])
        self.assertGreater(response['high'], 0)
        # low
        self.assertIn('low', response)
        self.assertIn(type(response['low']), [float, int])
        self.assertGreater(response['low'], 0)
        # volume
        self.assertIn('volume', response)
        self.assertIn(type(response['volume']), [float, int])
        self.assertGreaterEqual(response['volume'], 0)
        # amount
        self.assertIn('amount', response)
        self.assertIn(type(response['amount']), [float, int])
        self.assertGreaterEqual(response['amount'], 0)
        # market_name_cn
        self.assertIn('market_name_cn', response)
        #self.assertIsInstance(response['market_name_cn'], str)
        # market_name_en
        self.assertIn('market_name_en', response)
        self.assertIsInstance(response['market_name_en'], str)
        # take_code
        self.assertIn('take_code', response)
        self.assertIsInstance(response['take_code'], str)
        # pay_code
        self.assertIn('pay_code', response)
        self.assertIsInstance(response['pay_code'], str)
        # code
        self.assertIn('code', response)
        self.assertIsInstance(response['code'], str)
        self.assertGreater(len(response['code']), 0)
        # name
        self.assertIn('name', response)
        self.assertIsInstance(response['name'], str)
        self.assertGreater(len(response['name']), 0)
        # name_en
        self.assertIn('name_en', response)
        self.assertIsInstance(response['name_en'], str)
        # name_cn
        self.assertIn('name_cn', response)
        #self.assertIsInstance(response['name_cn'], str)
        # name_abbr
        self.assertIn('name_abbr', response)
        self.assertIsInstance(response['name_abbr'], str)
        # logo_url
        self.assertIn('logo_url', response)
        self.assertIsInstance(response['logo_url'], str)
    def test_symbol_list(self):
        """
        测试交易对列表接口
        """
        request = ConfigRequest()
        request.set_url(test_url)
        response = request.get()

        self.assertIsInstance(response, list)
        self.assertGreaterEqual(len(response), 0)
        for item in response:
            self.assertIsInstance(item, dict)
            #self.assertEqual(len(item), 16, msg='{} {} length is wrong'.format(item['market'], item['symbol']))
            # time
            self.assertIn('time', item)
            self.assertIsInstance(item['time'], int)
            # update_time
            self.assertIn('update_time', item)
            self.assertIsInstance(item['update_time'], int)
            # open
            self.assertIn('open', item)
            self.assertIn(type(item['open']), [float, int])
            self.assertGreater(item['open'], 0)
            # close
            self.assertIn('close', item)
            self.assertIn(type(item['close']), [float, int])
            self.assertGreater(item['close'], 0)
            # high
            self.assertIn('high', item)
            self.assertIn(type(item['high']), [float, int])
            self.assertGreater(item['high'], 0)
            # low
            self.assertIn('low', item)
            self.assertIn(type(item['low']), [float, int])
            self.assertGreater(item['low'], 0)
            # volume
            self.assertIn('volume', item)
            self.assertIn(type(item['volume']), [float, int])
            self.assertGreaterEqual(item['volume'], 0)
            # amount
            self.assertIn('amount', item)
            self.assertIn(type(item['amount']), [float, int])
            self.assertGreaterEqual(item['amount'], 0)
            # market
            self.assertIn('market', item)
            self.assertIsInstance(item['market'], str)
            self.assertGreater(len(item['market']), 0)
            # symbol
            self.assertIn('symbol', item)
            self.assertIsInstance(item['symbol'], str)
            self.assertGreater(len(item['symbol']), 0)
            # change
            # self.assertIn('change', item)
            # self.assertIn(type(item['change']), [float, int])
            # change_ratio
            # self.assertIn('change_ratio', item)
            # self.assertIn(type(item['change_ratio']), [float, int])
            # market_name_cn
            self.assertIn('market_name_cn', item)
            # self.assertIsInstance(item['market_name_cn'], str)
            # market_name_en
            self.assertIn('market_name_en', item)
            self.assertIsInstance(item['market_name_en'], str)
            # take_code
            self.assertIn('take_code', item)
            self.assertIsInstance(item['take_code'], str)
            # pay_code
            self.assertIn('pay_code', item)
            self.assertIsInstance(item['pay_code'], str)
    def test_token_code(self):
        """
        测试币种详情接口
        """
        request = ConfigRequest()
        request.set_url(test_url.format('Bitcoin'))
        response = request.get()

        self.assertIsInstance(response, dict)
        # code
        self.assertIn('code', response)
        self.assertIsInstance(response['code'], str)
        self.assertNotEqual(response['code'], '')
        # name
        self.assertIn('name', response)
        self.assertIsInstance(response['name'], str)
        self.assertNotEqual(response['name'], '')
        # name_cn
        self.assertIn('name_cn', response)
        # name_en
        self.assertIn('name_en', response)
        self.assertIsInstance(response['name_en'], str)
        self.assertNotEqual(response['name_en'], '')
        # name_abbr
        self.assertIn('name_abbr', response)
        self.assertIsInstance(response['name_abbr'], str)
        self.assertNotEqual(response['name_abbr'], '')
        # log_url
        self.assertIn('logo_url', response)
        self.assertIsInstance(response['logo_url'], str)
        self.assertNotEqual(response['logo_url'], '')
        # price
        self.assertIn('price', response)
        self.assertIn(type(response['price']), [float, int])
        self.assertGreater(response['price'], 0)
        # # change_ratio
        # self.assertIn('change_ratio', response)
        # self.assertIn(type(response['change_ratio']), [float, int])
        # # change
        # self.assertIn('change', response)
        # self.assertIn(type(response['change']), [float, int])
        # market_cap
        self.assertIn('market_cap', response)
        self.assertIn(type(response['market_cap']), [float, int])
        self.assertGreater(response['market_cap'], 0)
        # change_ratio_1h
        self.assertIn('change_ratio_1h', response)
        self.assertIn(type(response['change_ratio_1h']), [float, int])
        # change_ratio_7d
        self.assertIn('change_ratio_7d', response)
        self.assertIn(type(response['change_ratio_7d']), [float, int])
        # change_ratio_24h
        self.assertIn('change_ratio_24h', response)
        self.assertIn(type(response['change_ratio_24h']), [float, int])
        # circulation
        self.assertIn('circulation', response)
        self.assertIn(type(response['circulation']), [float, int])
        self.assertGreater(response['circulation'], 0)
        # turnover_24h
        self.assertIn('turnover_24h', response)
        self.assertIn(type(response['turnover_24h']), [float, int])
        self.assertGreater(response['turnover_24h'], 0)
        # time
        self.assertIn('time', response)
        self.assertIsInstance(response['time'], int)
        # update_time
        self.assertIn('update_time', response)
        self.assertIsInstance(response['update_time'], int)
    def test_f10_intro(self):
        """
        测试f10基本信息接口intro
        """
        request = ConfigRequest()
        request.set_url(test_url.format('Bitcoin'))
        response = request.get()

        self.assertIsInstance(response, dict)
        self.assertEqual(len(response), 20)
        # intro_total_supply
        self.assertIn('intro_total_supply', response)
        self.assertIsInstance(response['intro_total_supply'], str)
        self.assertGreater(len(response['intro_total_supply']), 0)
        # intro_chain
        self.assertIn('intro_chain', response)
        self.assertIsInstance(response['intro_chain'], str)
        self.assertGreater(len(response['intro_chain']), 0)
        # intro_mining
        self.assertIn('intro_mining', response)
        self.assertIsInstance(response['intro_mining'], str)
        self.assertGreater(len(response['intro_mining']), 0)
        # intro_on_market
        self.assertIn('intro_on_market', response)
        self.assertIsInstance('intro_on_market', str)
        self.assertGreater(len(response['intro_on_market']), 0)
        # intro_organization
        self.assertIn('intro_organization', response)
        self.assertIsInstance(response['intro_organization'], str)
        self.assertGreater(len(response['intro_organization']), 0)
        # intro_website
        self.assertIn('intro_website', response)
        self.assertIsInstance(response['intro_website'], str)
        self.assertGreater(len(response['intro_website']), 0)
        # intro_team
        self.assertIn('intro_team', response)
        self.assertIsInstance(response['intro_team'], str)
        self.assertGreater(len(response['intro_team']), 0)
        # intro_status
        self.assertIn('intro_status', response)
        self.assertIsInstance(response['intro_status'], str)
        self.assertGreater(len(response['intro_status']), 0)
        # ico_schedule
        self.assertIn('ico_schedule', response)
        self.assertIsInstance(response['ico_schedule'], str)
        # ico_price
        self.assertIn('ico_price', response)
        self.assertIsInstance(response['ico_price'], str)
        # ico_whitepaper
        self.assertIn('ico_whitepaper', response)
        self.assertIsInstance(response['ico_whitepaper'], str)
        self.assertGreater(len(response['ico_whitepaper']), 0)
        # ico_fund_allocation
        self.assertIn('ico_fund_allocation', response)
        self.assertIsInstance(response['ico_fund_allocation'], str)
        # ico_placement
        self.assertIn('ico_placement', response)
        self.assertIsInstance(response['ico_placement'], str)
        # ico_other_info
        self.assertIn('ico_other_info', response)
        # project_motive_solution
        self.assertIn('project_motive_solution', response)
        self.assertIsInstance(response['project_motive_solution'], str)
        self.assertGreater(len(response['project_motive_solution']), 0)
        # project_product
        self.assertIn('project_product', response)
        self.assertIsInstance(response['project_product'], str)
        self.assertGreater(len(response['project_product']), 0)
        # project_tech_highlight
        self.assertIn('project_tech_highlight', response)
        self.assertIsInstance(response['project_tech_highlight'], str)
        self.assertGreater(len(response['project_tech_highlight']), 0)
        # project_conception
        self.assertIn('project_conception', response)
        self.assertIsInstance(response['project_conception'], str)
        self.assertGreater(len(response['project_conception']), 0)
        # project_application_area
        self.assertIn('project_application_area', response)
        self.assertIsInstance(response['project_application_area'], str)
        self.assertGreater(len(response['project_application_area']), 0)
    def test_symbol_ranking_abbr(self):
        """
        测试交易对按volume排行接口
        """
        request = ConfigRequest()
        request.set_url(test_url)
        response = request.get()

        self.assertIsInstance(response, list)
        self.assertGreaterEqual(len(response), 0)

        for item in response:
            self.assertIsInstance(item, dict)
            self.assertGreaterEqual(len(item), 20)
            # time
            self.assertIn('time', item)
            self.assertIsInstance(item['time'], int)
            self.assertGreater(item['time'], 0)
            # update_time
            self.assertIn('update_time', item)
            self.assertIsInstance(item['update_time'], int)
            self.assertGreater(item['update_time'], 0)
            # open
            self.assertIn('open', item)
            self.assertIn(type(item['open']), [float, int])
            self.assertGreater(item['open'], 0)
            # close
            self.assertIn('close', item)
            self.assertIn(type(item['close']), [float, int])
            self.assertGreater(item['close'], 0)
            # high
            self.assertIn('high', item)
            self.assertIn(type(item['high']), [float, int])
            self.assertGreater(item['high'], 0)
            # low
            self.assertIn('low', item)
            self.assertIn(type(item['low']), [float, int])
            self.assertGreater(item['low'], 0)
            # volume
            self.assertIn('volume', item)
            self.assertIn(type(item['volume']), [float, int])
            self.assertGreaterEqual(item['volume'], 0)
            # amount
            self.assertIn('amount', item)
            self.assertIn(type(item['amount']), [float, int])
            self.assertGreaterEqual(item['amount'], 0)
            # market
            self.assertIn('market', item)
            self.assertIsInstance(item['market'], str)
            self.assertGreater(len(item['market']), 0)
            # symbol
            self.assertIn('symbol', item)
            self.assertIsInstance(item['symbol'], str)
            self.assertGreater(len(item['symbol']), 0)

            # market_name_cn
            self.assertIn('market_name_cn', item)
            #self.assertIsInstance(item['market_name_cn'], str)
            # market_name_en
            self.assertIn('market_name_en', item)
            self.assertIsInstance(item['market_name_en'], str)
            # take_code
            self.assertIn('take_code', item)
            self.assertIsInstance(item['take_code'], str)
            # pay_code
            self.assertIn('pay_code', item)
            self.assertIsInstance(item['pay_code'], str)
            # code
            self.assertIn('code', item)
            self.assertIsInstance(item['code'], str)
            self.assertGreater(len(item['code']), 0)
            # name
            self.assertIn('name', item)
            self.assertIsInstance(item['name'], str)
            self.assertGreater(len(item['name']), 0)
            # name_en
            self.assertIn('name_en', item)
            self.assertIsInstance(item['name_en'], str)
            # name_cn
            self.assertIn('name_cn', item)
            #self.assertIsInstance(item['name_cn'], str)
            # name_abbr
            self.assertIn('name_abbr', item)
            self.assertIsInstance(item['name_abbr'], str)
            # price
            self.assertIn('price', item)
            self.assertIn(type(item['price']), [float, int])
            self.assertGreater(item['price'], 0)