How to use createTests method in autotest

Best Python code snippet using autotest_python

bad_create.py

Source:bad_create.py Github

copy

Full Screen

1#!/usr/bin/python32'''3 (C) Copyright 2018-2021 Intel Corporation.4 SPDX-License-Identifier: BSD-2-Clause-Patent5'''6import os7import traceback8from apricot import TestWithServers9from avocado.core.exceptions import TestFail10class BadCreateTest(TestWithServers):11 """Test pool create calls.12 Test Class Description:13 Tests pool create API by passing NULL and otherwise inappropriate14 parameters. This use the python API.15 :avocado: recursive16 """17 def test_create(self):18 """Test ID: DAOS-???.19 Test Description:20 Pass bad parameters to pool create.21 :avocado: tags=all,full_regression22 :avocado: tags=tiny23 :avocado: tags=pool,bad_create24 """25 # Accumulate a list of pass/fail indicators representing what is26 # expected for each parameter then "and" them to determine the27 # expected result of the test28 expected_for_param = []29 modelist = self.params.get("mode", '/run/createtests/modes/*')30 mode = modelist[0]31 expected_for_param.append(modelist[1])32 uidlist = self.params.get("uid", '/run/createtests/uids/*')33 uid = uidlist[0]34 if uid == 'VALID':35 uid = os.geteuid()36 expected_for_param.append(uidlist[1])37 gidlist = self.params.get("gid", '/run/createtests/gids/*')38 gid = gidlist[0]39 if gid == 'VALID':40 gid = os.getegid()41 expected_for_param.append(gidlist[1])42 setidlist = self.params.get("setname", '/run/createtests/setnames/*')43 expected_for_param.append(setidlist[1])44 # Uncomment this block when we test targetptr.45 # targetlist = self.params.get("rankptr", '/run/createtests/target/*')46 # if targetlist[0] == 'NULL':47 # targetptr = None48 # else:49 # targetptr = [0]50 # expected_for_param.append(targetlist[1])51 # not ready for this yet52 # devicelist = self.params.get("devptr", '/run/createtests/device/*')53 # if devicelist[0] == 'NULL':54 # devptr = None55 # else:56 # devptr = devicelist[0]57 # expected_for_param.append(devicelist[1])58 sizelist = self.params.get("size", '/run/createtests/psize/*')59 size = sizelist[0]60 expected_for_param.append(sizelist[1])61 # parameter not presently supported62 # svclist = self.params.get("rankptr", '/run/createtests/svc/*')63 # if svclist[0] == 'NULL':64 # svc = None65 # else:66 # svc = None67 # expected_for_param.append(devicelist[1])68 # if any parameter is FAIL then the test should FAIL, in this test69 # virtually everyone should FAIL since we are testing bad parameters70 expected_result = 'PASS'71 for result in expected_for_param:72 if result == 'FAIL':73 expected_result = 'FAIL'74 break75 # initialize a python pool object then create the underlying76 # daos storage77 self.add_pool(create=False)78 # Manually set TestPool members before calling create79 self.pool.mode.value = mode80 self.pool.uid = uid81 self.pool.gid = gid82 self.pool.scm_size.value = size83 try:84 self.pool.create()85 if expected_result in ['FAIL']:86 self.fail("Test was expected to fail but it passed.\n")87 # create with invalid parameter will cause test failure, so catch it if88 # we expect it89 except TestFail as excep:90 self.log.error(str(excep))91 self.log.error(traceback.format_exc())92 if expected_result == 'PASS':...

Full Screen

Full Screen

0006_auto_20220701_0912.py

Source:0006_auto_20220701_0912.py Github

copy

Full Screen

1# Generated by Django 3.0.14 on 2022-07-01 03:272from django.db import migrations, models3class Migration(migrations.Migration):4 dependencies = [5 ('client', '0005_uxclient_isemailverified'),6 ]7 operations = [8 migrations.AddField(9 model_name='createtests',10 name='amountpaid',11 field=models.FloatField(blank=True, default=0, null=True),12 ),13 migrations.AddField(14 model_name='createtests',15 name='cardnumber',16 field=models.FloatField(blank=True, default=0, null=True),17 ),18 migrations.AddField(19 model_name='createtests',20 name='cvv',21 field=models.FloatField(blank=True, default=0, null=True),22 ),23 migrations.AddField(24 model_name='createtests',25 name='date_created',26 field=models.DateTimeField(auto_now_add=True, null=True),27 ),28 migrations.AddField(29 model_name='createtests',30 name='expirydate',31 field=models.DateTimeField(blank=True, null=True),32 ),33 migrations.AddField(34 model_name='createtests',35 name='nameoncard',36 field=models.CharField(blank=True, max_length=100, null=True),37 ),...

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