Best Python code snippet using localstack_python
updatableRunbookProvider.py
Source:updatableRunbookProvider.py
...83 raise84 def _next_available_version_name(self):85 client = get_ssm_client()86 document_version_names = []87 response = client.list_document_versions(Name = self._properties['Name'])88 for document_version in response['DocumentVersions']:89 document_version_names.append(document_version.get('VersionName', ''))90 token = response.get('NextToken', '')91 while (token):92 response = client.list_document_versions(Name = self._properties['Name'], NextToken = token)93 for document_version in response['DocumentVersions']:94 document_version_names.append(document_version.get('VersionName', ''))95 token = response.get('NextToken', '')96 version_name = self._properties.get('VersionName', '')97 prefix = f'{version_name}_' if version_name else ''98 versioning_schema = re.compile(r'^' + re.escape(prefix) + r'Rev_(\d+)$')99 newest_version = 1100 for version_str in document_version_names:101 match = versioning_schema.match(version_str)102 if match:103 version_int = int(match.group(1))104 if version_int > newest_version:105 newest_version = version_int106 return f'{prefix}Rev_{str(newest_version + 1)}'...
test_archive_functions.py
Source:test_archive_functions.py
...59 retrieve_document_version('valid_doc_type', 'valid_key2', 888)60 def test_list_our_writes(self):61 expected = {'key1': 'value1'}62 archive_document_version('valid_doc_type', 'valid_key', 999, expected)63 all_archived = list_document_versions('valid_doc_type', 'valid_key')64 assert expected in all_archived65@pytest.mark.usefixtures('db_session')66class TestBugs(object):67 def test_datetime_gets_encoded(self):68 expected = {'key1': 'value1', 'when': datetime.now()}69 archive_document_version('valid_doc_type', 'valid_key', 2222, expected)70 actual = retrieve_document_version('valid_doc_type', 'valid_key', 2222)...
urls.py
Source:urls.py
1from django.urls import path2from apps.projects.views import DocumentUpdateView3from apps.dashboard import views4urlpatterns = [5 path('', views.OwnerDocumentsView.as_view(), name="owner_documents"),6 path('<str:template>/document/<int:pk>',7 views.DocumentEditorAnalyzeView.as_view(),8 name='document_editor_analyze'),9 path('editor/document/<int:pk>/save/',10 views.SaveDocumentView.as_view(),11 name='save_document'),12 path('editor/document/<int:pk>/versions/',13 views.ListDocumentVersionsView.as_view(),14 name='list_document_versions'),15 path('edit/<int:pk>-<slug:documment_slug>/',16 DocumentUpdateView.as_view(), name="edit_document"),...
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!!