Beispiel #1
0
 def test_delete_organization_correct_parameters(self):
     u"""正确参数"""
     LOG.info('------登录成功用例:start!---------')
     result = self.delete_organization()
     LOG.info('获取测试结果:%s' % result)
     self.assertErrorResult(result, const.ErrNotSupportDeleteOrganization)
     LOG.info('------pass!---------')
Beispiel #2
0
 def test_safe_email_error_serial_number(self):
     u"""serial_number验证码错误"""
     LOG.info("------用户设置安全邮箱:start!---------")
     result = self.safe_email(self.verification_code, '', data.email)
     LOG.info("获取测试结果:%s" % result)
     self.assertErrorResult(result, const.InvalidVcRecord)
     LOG.info("------pass!---------")
Beispiel #3
0
 def test_analyze_error_cid(self):
     u"""cid错误参数"""
     LOG.info('------登录成功用例:start!---------')
     result = self.analyze('1000', '', 'Q0001.0', 'QC0002.0')
     LOG.info('获取测试结果:%s' % result)
     self.assertErrorResult(result, const.ErrInvalidValue)
     LOG.info('------pass!---------')
Beispiel #4
0
 def test_get_analyze_correct_parameters(self):
     u"""正确参数"""
     LOG.info("------登录成功用例:start!---------")
     result = self.get_analyze()
     LOG.info("获取测试结果:%s" % result)
     self.assertOkResult(result)
     LOG.info("------pass!---------")
Beispiel #5
0
 def test_connect_qrcode_correct_parameters(self):
     u"""正确参数"""
     LOG.info("------获取解绑微信二维码:start!---------")
     result = self.connect_qrcode_delete()
     LOG.info("获取测试结果:%s" % result)
     self.assertOkResult(result)
     LOG.info("------pass!---------")
Beispiel #6
0
 def test_users_delete_correct_parameters(self):
     u"""正确参数"""
     LOG.info("------登录成功用例:start!---------")
     result = self.users_delete(95002)
     LOG.info("获取测试结果:%s" % result)
     self.assertOkResult(result)
     LOG.info("------pass!---------")
Beispiel #7
0
 def test_users_delete_error_users(self):
     u"""删除不存在的用户 """
     LOG.info("------登录成功用例:start!---------")
     result = self.users_delete(100000000)
     LOG.info("获取测试结果:%s" % result)
     self.assertOkResult(result)
     LOG.info("------pass!---------")
Beispiel #8
0
 def test_get_url_error_app_version(self):
     u"""错误参数 ,app版本为空"""
     LOG.info("------登录成功用例:start!---------")
     result = self.get_url(data.client_id, '', 1)
     LOG.info("获取测试结果:%s" % result)
     self.assertErrorResult(result, const.ErrRPCInternal)
     LOG.info("------pass!---------")
    def prepare(self, block_height, address='', deposit=0.0, key=''):
        super(ChannelDepositEvent, self).prepare(block_height)

        # if this transaction id is approved, it means successful by eth block chain
        if self.approved_tx_id:
            checked = self.check_transaction_success(self.approved_tx_id)
            if checked:
                LOG.debug('Approved asset by address<{}:{}>'.format(address, deposit))
                Channel.update_channel(self.channel_name, state=EnumChannelState.OPENING.name)
                LOG.info('Start to create channel<{}>. State: OPENING.'.format(self.channel_name))
                console_log.info('Channel<{}> is opening'.format(self.channel_name))
                # go to next stage
                self.next_stage()
                return True
            elif checked is False:
                return False
            else:
                # new transaction is pushed to chain
                self.approved_tx_id = None
        else:
            approved_deposit = self.contract_event_api.get_approved_asset(address)
            if approved_deposit >= int(deposit):
                LOG.debug('Has already approved: {}'.format(approved_deposit))
                # go to next stage
                self.next_stage()
                return True
            
        # make transaction to chain
        result = self.contract_event_api.approve(address, int(deposit), key, gwei_coef=self.gwei_coef)
        if result:
            self.approved_tx_id = '0x'+result.strip()

        return False
Beispiel #10
0
 def test_admins_correct_parameters(self):
     u"""正确参数"""
     LOG.info("------登录成功用例:start!---------")
     result = self.admins('2')
     LOG.info("获取测试结果:%s" % result)
     self.assertOkResult(result)
     LOG.info("------pass!---------")
Beispiel #11
0
 def test_get_url_correct_parameters_android(self):
     u"""android正确参数"""
     LOG.info("------登录成功用例:start!---------")
     result = self.get_url(data.client_id, self.app_version, 0)
     LOG.info("获取测试结果:%s" % result)
     self.assertOkResult(result)
     LOG.info("------pass!---------")
Beispiel #12
0
 def test_client_client_id_no_exit(self):
     u"""client_id不存在"""
     LOG.info("------登录成功用例:start!---------")
     result = self.client('123', data.secret_key_hash, '')
     LOG.info("获取测试结果:%s" % result)
     self.assertErrorResult(result, const.ErrRPCInternal)
     LOG.info("------pass!---------")
Beispiel #13
0
 def test_client_error_secret_key(self):
     u"""secret_key_hash参数为空"""
     LOG.info("------登录成功用例:start!---------")
     result = self.client(data.client_id, '', '')
     LOG.info("获取测试结果:%s" % result)
     self.assertErrorResult(result, const.ErrInvalidSecretKey)
     LOG.info("------pass!---------")
Beispiel #14
0
 def test_client_correct_parameters(self):
     u"""正确参数"""
     LOG.info("------登录成功用例:start!---------")
     result = self.client(data.client_id, data.secret_key_hash, '')
     LOG.info("获取测试结果:%s" % result)
     self.assertOkResult(result)
     LOG.info("------pass!---------")
Beispiel #15
0
 def test_sign_in_phone_mvc(self):
     u"""手机验证码登录"""
     LOG.info("------登录成功用例:start!---------")
     result = self.sign_in('phone_mvc', '', data.phone, self.mvc, '', data.seed_phone, self.nation, data.nation_code)
     LOG.info("获取测试结果:%s" % result)
     self.assertOkResult(result)
     LOG.info("------pass!---------")
Beispiel #16
0
 def test_version_correct_parameters(self):
     u"""正确参数"""
     LOG.info("------查看版本信息:start!---------")
     result = self.version()
     LOG.info("获取测试结果:%s" % result)
     self.assertOkResult(result)
     LOG.info("------pass!---------")
Beispiel #17
0
 def test_subscription_correct_parameters(self):
     u"""正确参数"""
     LOG.info('------登录成功用例:start!---------')
     result = self.subscription()
     LOG.info('获取测试结果:%s' % result)
     self.assertOkResult(result)
     LOG.info('------pass!---------')
Beispiel #18
0
    def execute(self,
                block_height,
                invoker_uri='',
                channel_name='',
                hashcode='',
                rcode='',
                invoker_key='',
                is_debug=False):
        """

        :param block_height:
        :param invoker_uri:
        :param channel_name:
        :param hashcode:
        :param rcode:
        :param invoker_key:
        :param is_debug:
        :return:
        """
        super(ChannelHtlcUnlockEvent, self).execute(block_height)

        LOG.debug('unlock htlc payment parameter: {}, {}, {}'.format(
            invoker_uri, channel_name, hashcode))
        LOG.debug('unlock htlc payment event args: {}, kwargs {}' \
                  .format(self.event_arguments.args, self.event_arguments.kwargs))

        # close channel event
        result = Channel.force_release_htlc(
            invoker_uri,
            channel_name,
            hashcode,
            rcode,
            invoker_key,
            gwei_coef=self.gwei_coef,
            trigger=self.contract_event_api.htlc_unlock_payment,
            is_debug=is_debug)

        # Don't close channel
        if result and 'success' in result.values():
            self.next_stage()
Beispiel #19
0
 def test_users_delete_error_parameters(self):
     u"""传值类型不正确"""
     LOG.info("------登录成功用例:start!---------")
     result = self.users_delete('a')
     LOG.info("获取测试结果:%s" % result)
     self.assertOkResult(result)
     LOG.info("------pass!---------")
Beispiel #20
0
 def test_signin_qrcode_correct_parameters(self):
     u"""正确参数"""
     LOG.info("------登录成功用例:start!---------")
     result = self.signin_qrcode()
     LOG.info("获取测试结果:%s" % result)
     self.assertOkResult(result)
     LOG.info("------pass!---------")
Beispiel #21
0
 def test_user_questions_correct_parameters(self):
     u"""正确参数"""
     LOG.info("------设置/修改密保:start!---------")
     result = self.user_preferences()
     LOG.info("获取测试结果:%s" % result)
     self.assertOkResult(result)
     LOG.info("------pass!---------")
Beispiel #22
0
 def test_sign_in_error_hashed_password(self):
     u"""hashed_password为空"""
     LOG.info("------登录成功用例:start!---------")
     result = self.sign_in('username_password', data.username, '', '', '', data.seed_phone, '', '')
     LOG.info("获取测试结果:%s" % result)
     self.assertErrorResult(result, const.ErrUsernamePasswordNotMatch)
     LOG.info("------pass!---------")
Beispiel #23
0
 def test_safe_email_mvc_null(self):
     u"""mvc为空"""
     LOG.info("------用户解除设置安全邮箱:start!---------")
     result = self.safe_email_delete('', self.serial_number, data.email)
     LOG.info("获取测试结果:%s" % result)
     self.assertErrorResult(result, const.InvalidVcRecord)
     LOG.info("------pass!---------")
Beispiel #24
0
 def test_sign_in_error_serial_number(self):
     u"""序列号错误"""
     LOG.info("------登录成功用例:start!---------")
     result = self.sign_in('phone_mvc', '', data.phone, '123456', '', data.seed_phone, '', data.nation_code)
     LOG.info("获取测试结果:%s" % result)
     self.assertErrorResult(result,const.InvalidVcRecord)
     LOG.info("------pass!---------")
Beispiel #25
0
 def test_safe_email_error_mvc(self):
     u"""mvc验证码错误"""
     LOG.info("------用户设置安全邮箱:start!---------")
     result = self.safe_email('123', self.serial_number, data.email)
     LOG.info("获取测试结果:%s" % result)
     self.assertErrorResult(result, const.InvalidVcRecord)
     LOG.info("------pass!---------")
Beispiel #26
0
 def test_sign_inc_phone_not_correspond_nation_code(self):
     u"""手机与验证码对应不上"""
     LOG.info("------登录成功用例:start!---------")
     result = self.sign_in('phone_mvc', '', data.phone, '123456', '', data.seed_phone, self.nation, "+1")
     LOG.info("获取测试结果:%s" % result)
     self.assertErrorResult(result,const.ErrNonexistentPhone)
     LOG.info("------pass!---------")
Beispiel #27
0
 def test_analyze_correct_parameters(self):
     u"""正确参数"""
     LOG.info('------登录成功用例:start!---------')
     result = self.analyze(206839, '', 'Q0001.0', 'QC0002.0')
     LOG.info('获取测试结果:%s' % result)
     self.assertOkResult(result)
     LOG.info('------pass!---------')
Beispiel #28
0
 def test_sign_in_olduser_error(self):
     """老用户密码错误"""
     LOG.info("------登录成功用例:start!---------")
     result = self.sign_in('username_password', data.username, '', '', '666862446769', '', '', '')
     LOG.info("获取测试结果:%s" % result)
     self.assertErrorResult(result, const.ErrUsernamePasswordNotMatch)
     LOG.info("------pass!---------")
Beispiel #29
0
 def test_analyze_error_analysis_session(self):
     u"""analysis_session错误参数"""
     LOG.info('------登录成功用例:start!---------')
     result = self.analyze(206839, 's', 'Q0001', 'QC0002.0')
     LOG.info('获取测试结果:%s' % result)
     self.assertErrorResult(result, const.ErrInvalidValue)
     LOG.info('------pass!---------')
Beispiel #30
0
 def test_put_profile(self):
     data = {
         "profile":
             {
                 "nickname": "哈哈",
                 "birthday":  '2018-10-15T02:41:31Z',
                 "gender": 1,
                 "height": 160,
                 "weight": 45,
                 "phone": "",
                 "email": "",
                 "remark": "",
                 "user_defined_code": "",
                 "state": "",
                 "city": "",
                 "street": "",
                 "country": ""
             }
     }
     url = self.host + 'owner/users/118526/profile'
     LOG.info("请求url:%s" % url)
     res = requests.put(url=url, json=data, headers=Util().get_token())
     LOG.info("获取测试结果:%s" % res.json())
     self.assertOkResult(res.json())
     LOG.info("------pass!---------")