Best Python code snippet using locust
urls.py
Source: urls.py
1from django.conf.urls import url2from deploy.views.DeployTaskView import DeployTaskView,DeployTaskSearchView,DeployTaskDelete,DeployTaskExamine3from deploy.views.UploadFileView import UploadFileView4from deploy.views.ScriptExecuteView import FileListView,FileExecuteView,FileDelete,ExecuteResView5from deploy.views.DeployTaskView import test_pass,backspace,sql_file_download,test_report_download,receiving_report_download6from deploy.views.DeployTaskView import TestReportUploadView7from deploy.views.DeployTaskView import DeployDetailView8from deploy.views.DeployTaskView import upgrade_success_deploytask9from deploy.views.DeployTaskView import upgrade_failure_deploytask,upgrade_partition_deploytask,upgrade_continue_deploytask10from deploy.views.ScriptView import ScriptManageView,ScriptAddView,ScriptUpdateView,ScriptExecuteView,ScriptDeleteView,ScriptTransferView11from deploy.views.DBFileView import SchemaView,VerifyPersonView12from deploy.views.DeployTaskView import upgrade_deploytask13from deploy.views.SqlExecuteView import SqlFileUpload,SqlFile,SqlFileDelete,SqlFileDetail,sqlfile_download14from django.views.decorators.csrf import csrf_exempt15urlpatterns = [16 url(r"^task/$",csrf_exempt(DeployTaskView.as_view()),name="deploy_task"),17 url(r"^task/list/$",csrf_exempt(DeployTaskSearchView.as_view()),name="deploy_task_list"),18 url(r"^task/detail/(?P<module_name>(.*))/$",csrf_exempt(DeployDetailView.as_view()),name="deploy_task_detail"),19 url(r"^task/delete/(?P<id>[0-9]+)/$",csrf_exempt(DeployTaskDelete.as_view()),name="deploy_task_delete"),20 url(r"^task/examine/(?P<id>[0-9]+)/$",csrf_exempt(DeployTaskExamine.as_view()),name="deploy_task_examine"),21 url(r"^task/test/pass/(?P<module_name>(.*))/(?P<tag_version>(.*))/$",test_pass,name="test_pass"),22 url(r"^task/back/(?P<principal>(.*))/(?P<project>(.*))/(?P<tag_version>(.*))/$",backspace,name="backspace"),23 url(r"^task/download/sql/file/(?P<module_name>(.*))/(?P<tag_version>(.*))/$",sql_file_download,name="download_sql"),24 url(r"^task/test/report/upload/(?P<module_name>(.*))/(?P<tag_version>(.*))/$",csrf_exempt(TestReportUploadView.as_view()),name="test_report_upload"),25 url(r"^task/test/report/download/(?P<module_name>(.*))/(?P<tag_version>(.*))/(?P<test_report_filename>(.*))/$",test_report_download,name="test_report_download"),26 url(r"^task/receiving/report/download/(?P<module_name>(.*))/(?P<tag_version>(.*))/(?P<receiving_report_filename>(.*))/$",receiving_report_download,name="receiving_report_download"),27 url(r"^task/rdsschema/select/$",csrf_exempt(SchemaView.as_view()),name="schema"),28 url(r"^task/verifyperson/select/$",csrf_exempt(VerifyPersonView.as_view()),name="verify_person"),29 url(r"^task/upgrade/(?P<id>[0-9]+)/$",upgrade_deploytask,name="upgrade_deploytask"),30 url(r"^task/upgrade/success/(?P<id>[0-9]+)/$",upgrade_success_deploytask,name="upgrade_success"),31 url(r"^task/upgrade/failure/(?P<id>[0-9]+)/$",upgrade_failure_deploytask,name="upgrade_failure"),32 url(r"^task/upgrade/partition/(?P<module_name>(.*))/(?P<tag_version>(.*))/$",upgrade_partition_deploytask,name="upgrade_partition"),33 url(r"^task/upgrade/continue/(?P<module_name>(.*))/(?P<tag_version>(.*))/$",upgrade_continue_deploytask,name="upgrade_continue"),34 url(r"^scripts/$",csrf_exempt(ScriptManageView.as_view()),name="script_manage"),35 url(r"^scripts/add/$",csrf_exempt(ScriptAddView.as_view()),name="script_add"),36 url(r"^scripts/delete/(?P<id>[0-9]+)/$",csrf_exempt(ScriptDeleteView.as_view()),name="script_delete"),37 url(r"^scripts/update/(?P<id>[0-9]+)/$",csrf_exempt(ScriptUpdateView.as_view()),name="script_update"),38 url(r"^scripts/execute/(?P<id>[0-9]+)/$",csrf_exempt(ScriptExecuteView.as_view()),name="minion_select"),39 url(r"^scripts/execute/$",csrf_exempt(ScriptExecuteView.as_view()),name="script_execute"),40 url(r"^scripts/transfer/(?P<id>[0-9]+)/$",csrf_exempt(ScriptTransferView.as_view()),name="minions_select"),41 url(r"^upload/file/$",csrf_exempt(UploadFileView.as_view()),name="upload_file"),42 url(r"^upload/file/list/$",csrf_exempt(FileListView.as_view()),name="execute_file_list"),43 url(r"^upload/file/execute/(?P<id>[0-9]+)/$",csrf_exempt(FileExecuteView.as_view()),name="execute_file"),44 url(r"^upload/file/delete/(?P<id>[0-9]+)/$",csrf_exempt(FileDelete.as_view()),name="delete_file"),45 url(r"^execute/file/res/(?P<id>[0-9]+)/$",csrf_exempt(ExecuteResView.as_view()),name="execute_file"),46 url(r"^sql/upload/$",csrf_exempt(SqlFileUpload.as_view()),name="sql_upload"),47 url(r"^sql/upload/list/$",csrf_exempt(SqlFile.as_view()),name="sql_file_list"),48 url(r"^sql/upload/detail/(?P<upload_person>(.*))/$",csrf_exempt(SqlFileDetail.as_view()),name="sql_file_detail"),49 url(r"^sql/upload/delete/(?P<id>[0-9]+)/$",csrf_exempt(SqlFileDelete.as_view()),name="sql_file_delete"),50 url(r"^sql/upload/download/(?P<id>[0-9]+)/$",sqlfile_download,name="sql_file_download")...
test_batch_download.py
Source: test_batch_download.py
1# Use workbook fixture from BDD tests (including elasticsearch)2from .features.conftest import app_settings, app, workbook3def test_report_download(testapp, workbook):4 res = testapp.get('/report.tsv?type=Experiment&sort=accession')5 assert res.headers['content-type'] == 'text/tsv; charset=UTF-8'6 disposition = res.headers['content-disposition']7 assert disposition.startswith('attachment;filename="Experiment Report') and disposition.endswith('.tsv"')8 lines = res.body.splitlines()9 assert lines[1].split(b'\t') == [10 b'ID', b'Accession', b'Assay Type', b'Assay Nickname', b'Target label',11 b'Target gene', b'Biosample summary', b'Biosample', b'Description', b'Lab',12 b'Project', b'Status', b'Biological replicate', b'Technical replicate',13 b'Linked Antibody', b'Species', b'Life stage', b'Age', b'Age Units',14 b'Treatment', b'Term ID', b'Concentration', b'Concentration units',15 b'Duration', b'Duration units', b'Synchronization',16 b'Post-synchronization time', b'Post-synchronization time units',17 b'Replicates',...
Check out the latest blogs from LambdaTest on this topic:
Joseph, who has been working as a Quality Engineer, was assigned to perform web automation for the company’s website.
Lack of training is something that creates a major roadblock for a tester. Often, testers working in an organization are all of a sudden forced to learn a new framework or an automation tool whenever a new project demands it. You may be overwhelmed on how to learn test automation, where to start from and how to master test automation for web applications, and mobile applications on a new technology so soon.
There are times when developers get stuck with a problem that has to do with version changes. Trying to run the code or test without upgrading the package can result in unexpected errors.
Websites and web apps are growing in number day by day, and so are the expectations of people for a pleasant web experience. Even though the World Wide Web (WWW) was invented only in 1989 (32 years back), this technology has revolutionized the world we know back then. The best part is that it has made life easier for us. You no longer have to stand in long queues to pay your bills. You can get that done within a few minutes by visiting their website, web app, or mobile app.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!