How to use test_create_container method in tempest

Best Python code snippet using tempest_python

test_py_objectstore.py

Source:test_py_objectstore.py Github

copy

Full Screen

...72# Then we stream a download73# Then we stream a download of a non-existent file...74# When the session ends the objects gets deleted again.75@pytest.mark.dependency(depends=[])76def test_create_container():77 print(f'Creating container {bucket}')78 c = storage.create_container(bucket)79 objs = len(list(storage.list_container(bucket)))80 print("Container contents:", objs)81 assert objs == 082 assert c != None83@pytest.mark.dependency(depends=["test_create_container"])84def test_streaming_upload():85 list = iter(object_content)86 objects = storage.list_container(bucket)87 assert len(objects) == 088 storage.upload_stream(container=bucket, name=objectname, iterator=list)89 objects = storage.list_container(bucket)90 assert len(objects) == 1...

Full Screen

Full Screen

base.py

Source:base.py Github

copy

Full Screen

1import responses2from requests.status_codes import codes3import re4import os5base_url = 'https://api-test.intros.at/1'6path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'responses')7examples = {}8for item in os.listdir(path):9 if item.endswith('.json'):10 fname, ext = os.path.splitext(item)11 with open(os.path.join(path, item), 'r') as f:12 examples[fname] = f.read()13class GripTestsBase():14 default_uri = re.compile('%s/(\w+)' % (base_url))15 requests_mock = {16 'test_list_containers': {17 'uri': '%s/container' % base_url,18 'body': '{"success":true,"data":[{"id":17732,"name":"Test"}]}'19 },20 'test_get_container': {21 'uri': re.compile('%s/container/\d+' % base_url),22 'body': examples['test_get_container']23 },24 'test_create_container': {25 'uri': '%s/container' % base_url,26 'body': examples['test_create_container'],27 'method': responses.POST28 },29 'test_base_url_auto': {30 'uri': '%s/container' % base_url,31 'body': '{"success":true,"data":[{"id":17732,"name":"Test"}]}'32 },33 'test_get_container_things': {34 'uri': re.compile('%s/container/\d+/thing' % base_url),35 'body': examples['test_get_container_things']36 },37 'test_get_thing_detail': {38 'uri': re.compile('%s/thing/\d+' % base_url),39 'body': examples['test_get_thing_detail']40 },41 'test_get_categories': {42 'uri': '%s/thing/category' % base_url,43 'body': examples['test_get_categories']44 },45 'test_create_thing_from_thing': {46 'uri': '%s/thing' % base_url,47 'body': examples['test_create_thing_from_thing'],48 'method': responses.POST49 },50 'test_container_add_thing': {51 'uri': re.compile('%s/container/\d+/thing/\d+' % base_url),52 'body': '{"success": true,"data": '53 '{"message": "join created",'54 '"uri": "/1/container/23/thing/5577"}}',55 'method': responses.PUT56 },57 'test_container_remove_thing': {58 'uri': re.compile('%s/container/\d+/thing/\d+' % base_url),59 'body': '{"success": true, "data": '60 '{"success": "connection deleted"}}',61 'method': responses.DELETE62 },63 'test_thing_get_categories': {64 'uri': re.compile('%s/thing/\d+/category' % base_url),65 'body': examples['test_thing_get_categories']66 },67 'test_get_thing_auth_token': {68 'uri': re.compile('%s/thing/\d+/token' % base_url),69 'body': '{"success": true, '70 '"data": {'71 '"token": "a14e6e6c-8caa-4680-818e-dae482bb60fd"}}',72 },73 'test_update_thing': {74 'uri': re.compile('%s/thing/\d+' % base_url),75 'body': '{"success": true, "data": { "id": 7 }}',76 'method': responses.PATCH77 }78 }79 def setup_method(self, method):80 responses.start()81 request_data = self.requests_mock.get(method.__name__, {})82 responses.add(83 method=request_data.get('method', responses.GET),84 url=request_data.get('uri', self.default_uri),85 body=request_data.get('body', '{}'),86 status=request_data.get('status', codes.ok),87 content_type=request_data.get('content_type', 'application/json')88 )89 def teardown_method(self, method):90 responses.reset()...

Full Screen

Full Screen

test_container.py

Source:test_container.py Github

copy

Full Screen

...22from config import OBJECT_STORE_LIST23@pytest.mark.parametrize('object_store', OBJECT_STORE_LIST)24def test_container(object_store):25 container = Container_Test(object_store)26 container.test_create_container()27 container.test_delete_container()28class Container_Test:29 # def setup_class(self, param):30 def __init__(self, object_store):31 self.container = ObjectStoreFactory.create_store('test_fs', object_store).container32 33 def teardown_class(self):34 pass35 36 def test_create_container(self):37 self.container.create()38 container_list = self.container.list()39 for container in container_list:40 if self.container.name == container.name:41 return42 assert(False)43 44 def test_delete_container(self):45 response = self.container.delete()46 container_list = self.container.list()47 for container in container_list:48 if self.container.name == container.name:...

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 tempest 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