Ejemplo n.º 1
0
    def report(self):
        global path, data

        data = GetValue()
        now_time = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
        path = GetPath(data.getvalue('report_path') + '%s.html' % now_time)
        report_path = path.get_filePath()

        with open(report_path, 'wb') as fp:
            global runner
            runner = HTMLTestRunner.HTMLTestRunner(
                stream=fp,
                title=data.getvalue('title'),
                description=data.getvalue('description'))

            suiteTest = unittest.TestSuite()

            path = GetPath(data.getvalue('cases_path'))

            all_cases = unittest.defaultTestLoader.discover(
                path.get_filePath(), 'test_*.py')

            for case in all_cases:

                suiteTest.addTest(case)

            runner.run(suiteTest)

        email = Smtp()
        email.sendEmail(report_path)
 def setUp(self):
     global driver, data
     data = GetValue()
     browser = GetPath(data.getvalue('driver'))
     driver = webdriver.Chrome(browser.get_filePath())
     user = Login(driver)
     user.login(data.getvalue('address'), data.getvalue('account'),
                data.getvalue('password'))
    def setUp(self):
        global lg,data,token

        data = GetValue()

        lg = Login(data.getvalue('uat_address'))

        res = lg.login(data.getvalue('account'), data.getvalue('uat_password'))
        token=res['data']['token']
        self.assertEqual(res['data']['userName'], data.getvalue('account'))
        self.assertEqual(res['data']['accountType'], 1)
Ejemplo n.º 4
0
    def setUp(self):
        global lg, data, token, groupId, csm, planId, phoneId, auto_test, sip, sip_id, group_number

        data = GetValue()
        #登录
        lg = Login(data.getvalue('product_address'))
        res = lg.login(data.getvalue('account'),
                       data.getvalue('product_password'))
        token = res['data']['token']
        self.assertEqual(res['data']['userName'], data.getvalue('account'))
        self.assertEqual(res['data']['accountType'], 1)

        #创建客户组手动上传号码
        csm = CustomerManage(data.getvalue('product_address'))
        res2 = csm.addPhoneNumber(token, data.getvalue('userid'),
                                  ['17200001999'], 1, 'autoTest')
        self.assertEqual(res2['status'], 1000)
        self.assertEqual(res2['msg'], '操作成功')

        #查询mongodb获取groupId
        product = Mongodb('outbound_product', 'phone_number', '172.20.10.20',
                          27017)
        table = product.connect_mongodb()
        res3 = product.mongodb_find(table, {
            'userId': 21,
            'groupName': 'autoTest'
        })
        for item in res3:
            groupId = item['groupId']

        #添加SIP
        sip = sipManage(data.getvalue('product_address'))
        res = sip.add_sip(token)
        self.assertEqual(res['status'], 1000)
        self.assertEqual(res['msg'], '操作成功')

        #查询mysql获取线路id、group_number
        product_m = Mysql('172.20.10.14', 3306, 'root', 'kalamodo',
                          'outbound_product')
        con = product_m.connect_mysql()
        res = product_m.mysql_select(
            con[0],
            'SELECT id,group_number FROM ko_sipmanager where privately=21')
        for row in res:
            sip_id = row[0]
            group_number = row[1]

        #创建外呼计划
        auto_test = OutPlan(data.getvalue('product_address'))
        res = auto_test.creat_outplan(token, data.getvalue('userid'), '3706',
                                      'autoTest', '尚德销售纵线白名单', sip_id, groupId)
        planId = res['data']['planId']
        self.assertEqual(res['status'], 1000)
        self.assertEqual(res['msg'], '操作成功')

        #获取phoneid
        res = auto_test.get_CallDetail(token, planId)
        phoneId = res['data']['list'][0]['id']
Ejemplo n.º 5
0
class cusManage():

      def __init__(self,driver):
          self.driver=driver
          self.data = GetValue()

      def cus_manage(self):
          self.driver.find_element_by_xpath(self.data.getvalue('e_phoneNumManage')).click()


      def add_group(self,groupName):
          self.driver.find_element_by_xpath(self.data.getvalue('e_updateGroup')).click()
          time.sleep(2)
          self.driver.find_element_by_xpath(self.data.getvalue('e_addGroup')).click()
          time.sleep(2)
          self.driver.find_element_by_xpath(self.data.getvalue('e_inputName')).send_keys(groupName)
          time.sleep(2)
          self.driver.find_element_by_xpath(self.data.getvalue('e_commit')).click()

      def delete_group(self,groupName):
          self.driver.find_element_by_xpath(self.data.getvalue('e_deleteGroup').replace('%var%',groupName)).click()
          time.sleep(2)
          self.driver.find_element_by_xpath(self.data.getvalue('e_deleteCommit').replace('%var%',groupName)).click()
          time.sleep(2)
          self.driver.find_element_by_xpath(self.data.getvalue('e_ok')).click()
          time.sleep(2)
    def setUp(self):
        global lg,data

        data = GetValue()

        lg = Login(data.getvalue('dev_address'))

        res = lg.login(data.getvalue('account'), data.getvalue('dev_password'))

        try:
            self.assertEqual(res['data']['username'], data.getvalue('account'))
            self.assertEqual(res['data']['accountType'], 1)

        except Exception as e:
            print(e)
Ejemplo n.º 7
0
    def setUp(self):
        global lg, data, path

        data = GetValue()

        lg = Login(data.getvalue('product_address'))