How to use delete_test method in autotest

Best Python code snippet using autotest_python

test_integration.py

Source:test_integration.py Github

copy

Full Screen

...148 command, expected = self.get_command_and_expected('createObject', oid_class,149 object_name, parameters=parameters)150 result = self.api.post('{}/oidOperation'.format(self.device_uri), command)151 self.assertDictEqual(result, expected)152 def delete_test(self, oid_class, object_name):153 command, expected = self.get_command_and_expected('deleteObject', oid_class,154 object_name, parameters=None)155 result = self.api.post('{}/oidOperation'.format(self.device_uri), command)156 self.assertDictEqual(result, expected)157class MX960Test(BaseTest):158 def setUp(self):159 self.device = 'mx960'160 super(MX960Test, self).setUp()161 def test_oid_INTERFACE(self):162 params = [["encapsulation", "ethernet-ccc"],163 ["description", "test"],164 ["mtu", "4321"],165 ["apply_groups_accept", ["uRPF_interface", "ARP_interface"]],166 ["family_filter", "test-filter"]]167 self.create_test('INTERFACE', 'FAC_ge-0-0-0-0.0', params)168 self.delete_test('INTERFACE', 'FAC_ge-0-0-0-0.0')169 def test_oid_COS(self):170 params = [["scheduler_map", "test-map"]]171 self.create_test('COS', 'test1', params,)172 self.delete_test('COS', 'test1')173 def test_oid_COSVPLS(self):174 params = [["classifiers_exp", "classifier"]]175 self.create_test('COSVPLS', 'COSVPLS-test1', params)176 self.delete_test('COSVPLS', 'COSVPLS-test1')177 def test_oid_DISABLEINTERFACE(self):178 self.create_test('DISABLEINTERFACE', 'FAC_ge-0-0-0-0.0', [[]])179 self.delete_test('DISABLEINTERFACE', 'FAC_ge-0-0-0-0.0')180 def test_oid_COMMIT(self):181 self.create_test('COMMIT', '', [[]])182 def test_oid_FW3CPOLICER(self):183 params = [["cir", "10m"],184 ["cbs", "100k"],185 ["eir", "1m"],186 ["ebs", "50k"],187 ["color_mode", "aware"]]188 self.create_test('FW3CPOLICER', 'FW3CPOLICER-test_policer', params)189 self.delete_test('FW3CPOLICER', 'FW3CPOLICER-test_policer')190 def test_oid_FWFILTER(self):191 params = [["intf_specific", "true"],192 ["terms", [{193 "name": "t1",194 "then_3cpolicer": "single-rate test",195 "then_loss_priority": "loss_prio",196 "then_forwarding_class": "fwd_class",197 "then_accept": "true"198 }]]]199 self.create_test('FWFILTER', 'FWFILTER-inet-filter1', params)200 self.delete_test('FWFILTER', 'FWFILTER-inet-filter1')201 def test_oid_FWPOLICER(self):202 params = [["cir", "5m"],203 ["cbs", "100k"],204 ["then", "discard"]]205 self.create_test('FWPOLICER', 'FWPOLICER-test_policer', params)206 self.delete_test('FWPOLICER', 'FWPOLICER-test_policer')207 def test_oid_L2CIRCUIT(self):208 params = [["vcid", "NS_12345"],209 ["description", "test circuit"]]210 self.create_test('L2CIRCUIT', 'FAC_ge-0-0-0-0.0-10.12.23.24', params)211 self.delete_test('L2CIRCUIT', 'FAC_ge-0-0-0-0.0-10.12.23.24')212 def test_oid_ROUTINGINSTANCES(self):213 params = [["mac_table_size", "100"],214 ["interface_mac_limit", "10"],215 ["description", "test routing instance"]]216 self.create_test('ROUTINGINSTANCES', 'FAC_ge-0-0-0-0.0-NS_12345-123', params)217 self.delete_test('ROUTINGINSTANCES', 'FAC_ge-0-0-0-0.0-NS_12345-123')218 def test_oid_P2P_EPL(self):219 # FWPOLICER -> FWFILTER -> INTERFACE -> L2CIRCUIT -> deleteDISABLEINTERFACE -> COS -> COMMIT220 params = [["cir", "5m"],221 ["cbs", "100k"],222 ["then", "discard"]]223 self.create_test('FWPOLICER', 'FWPOLICER-test_policer', params)224 params = [["intf_specific", "true"],225 ["terms", [{226 "name": "t1",227 "then_3cpolicer": "single-rate test",228 "then_loss_priority": "loss_prio",229 "then_forwarding_class": "fwd_class",230 "then_accept": "true"231 }]]]232 self.create_test('FWFILTER', 'FWFILTER-inet-filter1', params)233 params = [["encapsulation", "ethernet-ccc"],234 ["description", "test"],235 ["mtu", "4321"],236 ["apply_groups_accept", ["uRPF_interface", "ARP_interface"]],237 ["family_filter", "filter1"]]238 self.create_test('INTERFACE', 'FAC_ge-0-0-0-0.0', params)239 params = [["vcid", "NS_12345"],240 ["description", "test circuit"]]241 self.create_test('L2CIRCUIT', 'FAC_ge-0-0-0-0.0-10.12.23.24', params)242 # delete the disable, which enables the interface243 self.delete_test('DISABLEINTERFACE', 'FAC_ge-0-0-0-0.0')244 params = [["scheduler_map", "test-map"]]245 self.create_test('COS', 'test1', params)246 self.create_test('COMMIT', '', [[]])247 # deprovisioning248 self.delete_test('COS', 'test1')249 # create the disable, which disables the interface250 self.create_test('DISABLEINTERFACE', 'FAC_ge-0-0-0-0.0', [[]])251 self.delete_test('L2CIRCUIT', 'FAC_ge-0-0-0-0.0-10.12.23.24')252 self.delete_test('INTERFACE', 'FAC_ge-0-0-0-0.0')253 self.delete_test('FWFILTER', 'FWFILTER-inet-filter1')254 self.delete_test('FWPOLICER', 'FWPOLICER-test_policer')255 self.create_test('COMMIT', '', [[]])256 def test_oid_MP_ELAN(self):257 # deleteDISABLEINTERFACE -> FWPOLICER -> FWFILTER -> INTERFACE -> ROUTINGINSTANCES -> COS -> COSVPLS -> COMMIT258 # delete the disable, which enables the interface259 self.delete_test('DISABLEINTERFACE', 'FAC_ge-0-0-0-0.0')260 params = [["cir", "5m"],261 ["cbs", "100k"],262 ["then", "discard"]]263 self.create_test('FWPOLICER', 'FWPOLICER-test_policer', params)264 params = [["intf_specific", "true"],265 ["terms", [{266 "name": "t1",267 "then_policer": "test_policer",268 "then_loss_priority": "loss_prio",269 "then_forwarding_class": "fwd_class",270 "then_accept": "true"271 }]]]272 self.create_test('FWFILTER', 'FWFILTER-inet-filter1', params)273 params = [["encapsulation", "ethernet-ccc"],274 ["description", "test"],275 ["mtu", "4321"],276 ["apply_groups_accept", ["uRPF_interface", "ARP_interface"]],277 ["family_filter", "filter1"]]278 self.create_test('INTERFACE', 'FAC_ge-0-0-0-0.0', params)279 params = [["mac_table_size", "100"],280 ["interface_mac_limit", "10"],281 ["description", "test routing instance"]]282 self.create_test('ROUTINGINSTANCES', 'FAC_ge-0-0-0-0.0-NS_12345-123', params)283 params = [["scheduler_map", "test-map"]]284 self.create_test('COS', 'test1', params)285 params = [["classifiers_exp", "classifier"]]286 self.create_test('COSVPLS', 'COSVPLS-testvpls1', params)287 self.create_test('COMMIT', '', [[]])288 # deprovisioning289 self.delete_test('COSVPLS', 'COSVPLS-testvpls1')290 self.delete_test('COS', 'test1')291 self.delete_test('ROUTINGINSTANCES', 'FAC_ge-0-0-0-0.0-NS_12345-123')292 self.delete_test('INTERFACE', 'FAC_ge-0-0-0-0.0')293 self.delete_test('FWFILTER', 'FWFILTER-inet-filter1')294 self.delete_test('FWPOLICER', 'FWPOLICER-test_policer')295 # create the disable, which disables the interface296 self.create_test('DISABLEINTERFACE', 'FAC_ge-0-0-0-0.0', [[]])297 self.create_test('COMMIT', '', [[]])298if __name__ == '__main__':299 # Get simulator ips from the files generated by the docker start scripts300 for dev, sim in SIMS.iteritems():301 with open(sim['docker_settings'], 'r') as f:302 lines = [line for line in f]303 # First line is the command used to start the adapter304 # second line is the container id305 # third line is the ip306 sim['interface'] = lines[2].strip()307 if sim['interface'] == '':308 raise ValueError('ERROR: Sim {} does not have an ip. Verify the container started properly'.format(...

Full Screen

Full Screen

station_csv_conv.py

Source:station_csv_conv.py Github

copy

Full Screen

1import sqlite32import csv3con = sqlite3.connect("stationData.db")4cur = con.cursor()5csv_list = ['station', 'line', 'pref']6for table in csv_list:7 if table == 'station':8 create_test = "CREATE TABLE IF NOT EXISTS station (id INTEGER, stationNo INTEGER, stationUno INTEGER, name TEXT, yomi TEXT,lineid INTEGER, prefNo INTEGER, address TEXT,lon TEXT,lat TEXT)"9 cur.execute(create_test)10 delete_test = "DELETE FROM station"11 cur.execute(delete_test)12 #csvファイルの指定13 open_csv = open("Station_output.csv")14 #csvファイルを読み込む15 read_csv = csv.reader(open_csv)16 17 #csvデータをINSERTする18 rows = []19 for row in read_csv:20 rows.append(row)21 #executemany()で複数のINSERTを実行する22 cur.executemany(23 "INSERT INTO station (id, stationNo, stationUno, name, yomi, lineid, prefNo, address, lon, lat) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", rows)24 25 elif table == 'line':26 create_test = "CREATE TABLE IF NOT EXISTS line (id INTEGER, lineid INTEGER, linename TEXT, lineCname TEXT)"27 cur.execute(create_test)28 delete_test = "DELETE FROM line"29 cur.execute(delete_test)30 open_csv = open("Line_output.csv")31 read_csv = csv.reader(open_csv)32 33 rows = []34 for row in read_csv:35 rows.append(row)36 cur.executemany(37 "INSERT INTO line (id, lineid, linename, lineCname) VALUES (?, ?, ?, ?)", rows)38 39 elif table == 'pref':40 create_test = "CREATE TABLE IF NOT EXISTS pref (id INTEGER, prefname TEXT)"41 cur.execute(create_test)42 delete_test = "DELETE FROM pref"43 cur.execute(delete_test)44 open_csv = open("Pref.csv")45 read_csv = csv.reader(open_csv)46 47 rows = []48 for row in read_csv:49 rows.append(row)50 cur.executemany(51 "INSERT INTO pref (id, prefname) VALUES (?, ?)", rows)52 #テーブルの変更内容保存53 con.commit()54 open_csv.close()55#データベースの接続終了...

Full Screen

Full Screen

urls.py

Source:urls.py Github

copy

Full Screen

1# -*- coding: utf8 -*-2from django.conf.urls import *3from questionnaires import views4urlpatterns = patterns('',5 # административные6 url(r'^$', views.index, name='account'),7 url(r'^data/$', views.index_data, name='account_data'),8 url(r'^createtest/$', views.create_test, name='create_test'),9 url(r'^createtest/(?P<questionnaire_id>[1-9]\d*)/$', views.create_test, name='create_test'),10 url(r'^deletetest/$', views.delete_test, name='delete_test'),11 url(r'^deletetest/(?P<questionnaire_id>[1-9]\d*)/$', views.delete_test, name='delete_test'),12 url(r'^createquestions/$', views.create_questions, name='create_questions'),13 url(r'^createquestions/(?P<questionnaire_id>[1-9]\d*)/$', views.create_questions, name='create_questions'),14 url(r'^getquestiondetails/(?P<question_id>[1-9]\d*)/$', views.get_question_details, name='get_question_details'),15 url(r'^deletequestion/$', views.delete_question, name='delete_question'),16 url(r'^deletequestion/(?P<question_id>[1-9]\d*)/$', views.delete_question, name='delete_question'),...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful