diff --git a/TestData/setting/email_integration_test_data.py b/TestData/setting/email_integration_test_data.py index 2eead25e1d030e2fd276e446881743d41af7030f..e4bf3e707f852f4fe8a2c8138ae940cd7cbe039b 100644 --- a/TestData/setting/email_integration_test_data.py +++ b/TestData/setting/email_integration_test_data.py @@ -4,4 +4,4 @@ class emailIntegrationData(Global): append_email_address = 'autotest@channelwill.cn' append_email_name = 'autotest' append_email_status = 0 - new_email_name = 'autotest2' \ No newline at end of file + new_email_name = 'autotest2' diff --git a/TestFile/account/account_selectLanguage.py b/TestFile/account/account_selectLanguage.py index 97d1ee9e6028fdecc4d4ea328efc360cc5e5cdc4..06a0d4ad438471e8c8fce0787505d77f29e089f2 100644 --- a/TestFile/account/account_selectLanguage.py +++ b/TestFile/account/account_selectLanguage.py @@ -1,6 +1,7 @@ from Utils.sql_handler import test_env_conn from TestData.account.account_test_data import accountData -select_sql = f'select * from willdesk.customer_service where id = {accountData.userId} ' +select_sql = f'select * from willdesk.customer_service where id = {accountData.userId}' select_result = test_env_conn.select_one_value(sql=select_sql) -assert select_result['local_lang'] == accountData.target_language \ No newline at end of file +setattr(accountData, 'local_lang', select_result['local_lang']) +# assert select_result['local_lang'] == accountData.target_language \ No newline at end of file diff --git a/TestFile/setting/emailIntegration/emailIntegration_insert.py b/TestFile/setting/emailIntegration/emailIntegration_insert.py new file mode 100644 index 0000000000000000000000000000000000000000..18a69c35a645c5aa25c9eaa5b7bbe991a2077e17 --- /dev/null +++ b/TestFile/setting/emailIntegration/emailIntegration_insert.py @@ -0,0 +1,10 @@ +from Utils.sql_handler import test_env_conn +from TestData.setting.email_integration_test_data import emailIntegrationData + +email_select_sql = f'select * from `email_config` where brand_id = {emailIntegrationData.brandId} and email = "{emailIntegrationData.append_email_address}"' +email_select_result = test_env_conn.select_one_value(email_select_sql) +if not email_select_result: + email_insert_sql = f"""INSERT INTO willdesk.email_config (brand_id,email_servicer_id,email,email_name,auth_code,refresh_token,raw_token,code_type,imap_addr,imap_port,imap_ssl,smtp_addr,smtp_port,smtp_ssl,enable_signature,signature_content,auth_folder,connect_status,failed_reason,status,create_at,update_at) VALUES + ({emailIntegrationData.brandId},7,'{emailIntegrationData.append_email_address}','{emailIntegrationData.append_email_name}','OJezniff5cTye4CqPyr3KA5F8HwmLiwyTAlBvYRKeWw=','','',0,'imap.com',993,0,'smtp.com',587,0,0,'
Best wishes
| Customer Support','1',1,'',{emailIntegrationData.append_email_status},'2024-04-19 17:11:37','2024-04-19 17:11:48'); +""" + test_env_conn.execute_sql(email_insert_sql) \ No newline at end of file diff --git a/YamlCase/account/account.yaml b/YamlCase/account/account.yaml index 7b85d55f2078b0d2e20454086a9a4dd9aadeff26..8cd63cbf8b280bdad2f242a215d134212746587d 100644 --- a/YamlCase/account/account.yaml +++ b/YamlCase/account/account.yaml @@ -51,6 +51,14 @@ api6: expected: - eq: {"$.code" : 0} +api7: + title: 检查设置语言 + url: /api/v1/customerService/getCustomerServiceInfo?v=${v} + method: get + expected: + - eq: { "$.code": 0 } + - eq: {"${local_lang}" : "${target_language}"} + api8: title: 检查翻译文本接口 url: /api/v1/translate/transKeyValue diff --git a/YamlCase/setting/emailIntegration.yaml b/YamlCase/setting/emailIntegration.yaml index a496a888f9925bcb9e68bb2f4047c4d22105f094..c531fd7429c3db1c9f2d1a722d75aeadd2a19f04 100644 --- a/YamlCase/setting/emailIntegration.yaml +++ b/YamlCase/setting/emailIntegration.yaml @@ -11,6 +11,7 @@ api2: title: 检查邮箱是否添加成功 url: /api/v1/email/listEmailConfig method: post + before_sql: /setting/emailIntegration/emailIntegration_insert.py data: {"v":"${v}"} expected: - eq: {"$.code": 0} diff --git a/main.py b/main.py index 93edb7c3afe6cad64f8cfc5a9b537571f74ddc60..81f915bbd61d0aa99bb48d8864bc95fb4a073115 100644 --- a/main.py +++ b/main.py @@ -1,13 +1,14 @@ import pytest -import requests.exceptions from Utils.webhook_handler import webhook from Utils.sql_handler import test_env_conn +import os if __name__ == '__main__': try: # pytest.main(['-vs',r'C:\Users\rd71\PycharmProjects\willdesk_api_auto\TestCase\inbox\test_06_channel.py',f'--alluredir=./allureReports/json','--clean-alluredir']) pytest.main(['-vs','./TestCase',f'--html=./report.html']) #allure报告一直生成不了,改用pytest自带报告 - + # pytest_run_command = 'pytest ./TestCase -vs -n=3 --reruns=1 --reruns-delay=3 --html=./report.html' + # os.system(pytest_run_command) finally: test_env_conn.close_db() #关闭数据库链接