Best Python code snippet using tempest_python
test_certificates.py
Source:test_certificates.py
1begin_unit2comment|'# Copyright 2012 Nebula, Inc.'3nl|'\n'4comment|'# Copyright 2013 IBM Corp.'5nl|'\n'6comment|'#'7nl|'\n'8comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'9nl|'\n'10comment|'# not use this file except in compliance with the License. You may obtain'11nl|'\n'12comment|'# a copy of the License at'13nl|'\n'14comment|'#'15nl|'\n'16comment|'# http://www.apache.org/licenses/LICENSE-2.0'17nl|'\n'18comment|'#'19nl|'\n'20comment|'# Unless required by applicable law or agreed to in writing, software'21nl|'\n'22comment|'# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT'23nl|'\n'24comment|'# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the'25nl|'\n'26comment|'# License for the specific language governing permissions and limitations'27nl|'\n'28comment|'# under the License.'29nl|'\n'30nl|'\n'31name|'from'32name|'oslo_config'33name|'import'34name|'cfg'35newline|'\n'36nl|'\n'37name|'from'38name|'nova'39op|'.'40name|'tests'41op|'.'42name|'functional'43op|'.'44name|'api_sample_tests'45name|'import'46name|'api_sample_base'47newline|'\n'48name|'from'49name|'nova'50op|'.'51name|'tests'52op|'.'53name|'unit'54name|'import'55name|'fake_crypto'56newline|'\n'57nl|'\n'58DECL|variable|CONF59name|'CONF'60op|'='61name|'cfg'62op|'.'63name|'CONF'64newline|'\n'65name|'CONF'66op|'.'67name|'import_opt'68op|'('69string|"'osapi_compute_extension'"70op|','71nl|'\n'72string|"'nova.api.openstack.compute.legacy_v2.extensions'"73op|')'74newline|'\n'75nl|'\n'76nl|'\n'77DECL|class|CertificatesSamplesJsonTest78name|'class'79name|'CertificatesSamplesJsonTest'80op|'('81name|'api_sample_base'82op|'.'83name|'ApiSampleTestBaseV21'84op|')'85op|':'86newline|'\n'87DECL|variable|extension_name88indent|' '89name|'extension_name'90op|'='91string|'"os-certificates"'92newline|'\n'93nl|'\n'94DECL|member|_get_flags95name|'def'96name|'_get_flags'97op|'('98name|'self'99op|')'100op|':'101newline|'\n'102indent|' '103name|'f'104op|'='105name|'super'106op|'('107name|'CertificatesSamplesJsonTest'108op|','109name|'self'110op|')'111op|'.'112name|'_get_flags'113op|'('114op|')'115newline|'\n'116name|'f'117op|'['118string|"'osapi_compute_extension'"119op|']'120op|'='121name|'CONF'122op|'.'123name|'osapi_compute_extension'124op|'['125op|':'126op|']'127newline|'\n'128name|'f'129op|'['130string|"'osapi_compute_extension'"131op|']'132op|'.'133name|'append'134op|'('135nl|'\n'136string|"'nova.api.openstack.compute.contrib.certificates.Certificates'"137op|')'138newline|'\n'139name|'return'140name|'f'141newline|'\n'142nl|'\n'143DECL|member|setUp144dedent|''145name|'def'146name|'setUp'147op|'('148name|'self'149op|')'150op|':'151newline|'\n'152indent|' '153name|'super'154op|'('155name|'CertificatesSamplesJsonTest'156op|','157name|'self'158op|')'159op|'.'160name|'setUp'161op|'('162op|')'163newline|'\n'164name|'self'165op|'.'166name|'stub_out'167op|'('168string|"'nova.crypto.ensure_ca_filesystem'"169op|','170nl|'\n'171name|'fake_crypto'172op|'.'173name|'ensure_ca_filesystem'174op|')'175newline|'\n'176name|'self'177op|'.'178name|'stub_out'179op|'('180string|"'nova.crypto.fetch_ca'"181op|','182name|'fake_crypto'183op|'.'184name|'fetch_ca'185op|')'186newline|'\n'187name|'self'188op|'.'189name|'stub_out'190op|'('191string|"'nova.crypto.generate_x509_cert'"192op|','193nl|'\n'194name|'fake_crypto'195op|'.'196name|'generate_x509_cert'197op|')'198newline|'\n'199name|'self'200op|'.'201name|'cert'202op|'='203name|'self'204op|'.'205name|'start_service'206op|'('207string|"'cert'"208op|')'209newline|'\n'210nl|'\n'211DECL|member|test_create_certificates212dedent|''213name|'def'214name|'test_create_certificates'215op|'('216name|'self'217op|')'218op|':'219newline|'\n'220indent|' '221name|'response'222op|'='223name|'self'224op|'.'225name|'_do_post'226op|'('227string|"'os-certificates'"228op|','229nl|'\n'230string|"'certificate-create-req'"231op|','232op|'{'233op|'}'234op|')'235newline|'\n'236name|'self'237op|'.'238name|'_verify_response'239op|'('240string|"'certificate-create-resp'"241op|','242op|'{'243op|'}'244op|','245name|'response'246op|','247number|'200'248op|')'249newline|'\n'250nl|'\n'251DECL|member|test_get_root_certificate252dedent|''253name|'def'254name|'test_get_root_certificate'255op|'('256name|'self'257op|')'258op|':'259newline|'\n'260indent|' '261name|'response'262op|'='263name|'self'264op|'.'265name|'_do_get'266op|'('267string|"'os-certificates/root'"268op|')'269newline|'\n'270name|'self'271op|'.'272name|'_verify_response'273op|'('274string|"'certificate-get-root-resp'"275op|','276op|'{'277op|'}'278op|','279name|'response'280op|','281number|'200'282op|')'283newline|'\n'284dedent|''285dedent|''286endmarker|''...
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!!