Best Python code snippet using autotest_python
urls.py
Source:urls.py
1#! /usr/bin/env python2# -*- coding: utf-8 -*-3from django.conf.urls import url,include4from django.contrib import admin5from rest_framework import routers, serializers, viewsets6router = routers.DefaultRouter()7# router.register(r'idcapi', IdcViewset,base_name='api_idc')8from views import *9router.register(r'1books', BookViewSet,base_name='api_books')10router.register(r'1publishers', PublisherViewSet,base_name='api_publisher')11urlpatterns = [12 url(r'^api/', include(router.urls)),13 url(r'^test_single/$',test_single,name='test_single'),14 url(r'^test_single_add/$', test_single_add, name='test_single_add'),15 url(r'^test_single_edit/(?P<id>[0-9]+)/$', test_single_edit, name='test_single_edit'),16 url(r'^test_single_page/$', test_single_page, name='test_single'),17 url(r'^publishers/$', PublisherList.as_view()),18 url(r'^publishers_page/$', PublisherListPage.as_view(),name='api_test_publisersh_page'),#å页åè½19 url(r'^publishers_detail/(?P<id>[0-9]+)/$', PublisherDetail.as_view()),20 url(r'del_publisher/$',Del_Publisher.as_view()),21 # url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),...
test_StudentGroupResource.py
Source:test_StudentGroupResource.py
...9 POST('/groups?name=testGroup&className=testClass&channel=testChannel')10 resp = GET('/students/group/testGroup')11 assert resp.status_code == 20012 assert resp.json() == []13def test_single_add():14 POST('/classes?className=testClass')15 POST('/groups?name=testGroup&className=testClass&channel=testChannel')16 POST('/students?firstName=testFirst&lastName=testLast&directoryId=testId&uid=0')17 POST('/student/directoryId/testId/group/testGroup')18 resp = GET('/students/group/testGroup')19 assert resp.status_code == 20020 students = resp.json()21 assert len(students) == 122 assert students[0]['firstName'] == 'testFirst'23 assert students[0]['lastName'] == 'testLast'24 assert students[0]['directoryId'] == 'testId'...
test_hierarchy.py
Source:test_hierarchy.py
...10 self.settings = convert.json2value(File("settings.json").read())11 Log.start(self.settings.debug)12 def tearDown(self):13 Log.stop()14 def test_single_add(self):15 source = Index(self.settings.source)16 sourceq = FromES(source)17 dest = Index(self.settings.destination)18 destq = FromES(dest)19 children = sourceq.query({20 "from": self.settings.source.alias,21 "select": ["bug_id", "dependson"],22 "where": {"and": [23 {"term": {"bug_id": 961592}},24 {"exists": {"field": "dependson"}}25 ]}26 })...
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!!