Best Python code snippet using localstack_python
test_one_rank_primary_contacts.py
Source:test_one_rank_primary_contacts.py
1# Copyright (C) 2019 Google Inc.2# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>3"""Test Access Control roles Primary Contacts propagation"""4import ddt5from ggrc.models import all_models6from integration.ggrc.access_control import rbac_factories7from integration.ggrc.access_control.acl_propagation import base8from integration.ggrc.utils import helpers9@ddt.ddt10class TestPrimaryContactsPropagation(base.TestACLPropagation):11 """Test Primary Contacts role permissions propagation"""12 PERMISSIONS = {13 "Creator": {14 "Universal AccessGroup": {15 "create_and_map_document": True,16 "read_document": True,17 "update_document": True,18 "delete_document": False,19 "create_and_map_comment": True,20 "read_comment": True,21 "create_and_map_document_comment": True,22 "read_document_comment": True,23 },24 "Universal DataAsset": {25 "create_and_map_document": True,26 "read_document": True,27 "update_document": True,28 "delete_document": False,29 "create_and_map_comment": True,30 "read_comment": True,31 "create_and_map_document_comment": True,32 "read_document_comment": True,33 },34 "Universal Facility": {35 "create_and_map_document": True,36 "read_document": True,37 "update_document": True,38 "delete_document": False,39 "create_and_map_comment": True,40 "read_comment": True,41 "create_and_map_document_comment": True,42 "read_document_comment": True,43 },44 "Universal Market": {45 "create_and_map_document": True,46 "read_document": True,47 "update_document": True,48 "delete_document": False,49 "create_and_map_comment": True,50 "read_comment": True,51 "create_and_map_document_comment": True,52 "read_document_comment": True,53 },54 "Universal Metric": {55 "create_and_map_document": True,56 "read_document": True,57 "update_document": True,58 "delete_document": False,59 "create_and_map_comment": True,60 "read_comment": True,61 "create_and_map_document_comment": True,62 "read_document_comment": True,63 },64 "Universal OrgGroup": {65 "create_and_map_document": True,66 "read_document": True,67 "update_document": True,68 "delete_document": False,69 "create_and_map_comment": True,70 "read_comment": True,71 "create_and_map_document_comment": True,72 "read_document_comment": True,73 },74 "Universal Process": {75 "create_and_map_document": True,76 "read_document": True,77 "update_document": True,78 "delete_document": False,79 "create_and_map_comment": True,80 "read_comment": True,81 "create_and_map_document_comment": True,82 "read_document_comment": True,83 },84 "Universal Product": {85 "create_and_map_document": True,86 "read_document": True,87 "update_document": True,88 "delete_document": False,89 "create_and_map_comment": True,90 "read_comment": True,91 "create_and_map_document_comment": True,92 "read_document_comment": True,93 },94 "Universal ProductGroup": {95 "create_and_map_document": True,96 "read_document": True,97 "update_document": True,98 "delete_document": False,99 "create_and_map_comment": True,100 "read_comment": True,101 "create_and_map_document_comment": True,102 "read_document_comment": True,103 },104 "Universal Project": {105 "create_and_map_document": True,106 "read_document": True,107 "update_document": True,108 "delete_document": False,109 "create_and_map_comment": True,110 "read_comment": True,111 "create_and_map_document_comment": True,112 "read_document_comment": True,113 },114 "Universal System": {115 "create_and_map_document": True,116 "read_document": True,117 "update_document": True,118 "delete_document": False,119 "create_and_map_comment": True,120 "read_comment": True,121 "create_and_map_document_comment": True,122 "read_document_comment": True,123 },124 "Universal TechnologyEnvironment": {125 "create_and_map_document": True,126 "read_document": True,127 "update_document": True,128 "delete_document": False,129 "create_and_map_comment": True,130 "read_comment": True,131 "create_and_map_document_comment": True,132 "read_document_comment": True,133 },134 "Universal Vendor": {135 "create_and_map_document": True,136 "read_document": True,137 "update_document": True,138 "delete_document": False,139 "create_and_map_comment": True,140 "read_comment": True,141 "create_and_map_document_comment": True,142 "read_document_comment": True,143 },144 "Universal KeyReport": {145 "create_and_map_document": True,146 "read_document": True,147 "update_document": True,148 "delete_document": False,149 "create_and_map_comment": True,150 "read_comment": True,151 "create_and_map_document_comment": True,152 "read_document_comment": True,153 },154 "MappedReview Program": {155 "create_review": True,156 "read_review": True,157 "update_review": True,158 "delete_review": False,159 },160 "MappedReview Regulation": {161 "create_review": True,162 "read_review": True,163 "update_review": True,164 "delete_review": False,165 },166 "MappedReview Objective": {167 "create_review": True,168 "read_review": True,169 "update_review": True,170 "delete_review": False,171 },172 "MappedReview Contract": {173 "create_review": True,174 "read_review": True,175 "update_review": True,176 "delete_review": False,177 },178 "MappedReview Policy": {179 "create_review": True,180 "read_review": True,181 "update_review": True,182 "delete_review": False,183 },184 "MappedReview Risk": {185 "create_review": True,186 "read_review": True,187 "update_review": True,188 "delete_review": False,189 },190 "MappedReview Standard": {191 "create_review": True,192 "read_review": True,193 "update_review": True,194 "delete_review": False,195 },196 "MappedReview Threat": {197 "create_review": True,198 "read_review": True,199 "update_review": True,200 "delete_review": False,201 },202 "MappedReview Requirement": {203 "create_review": True,204 "read_review": True,205 "update_review": True,206 "delete_review": False,207 },208 },209 "Reader": {210 "Universal AccessGroup": {211 "create_and_map_document": True,212 "read_document": True,213 "update_document": True,214 "delete_document": False,215 "create_and_map_comment": True,216 "read_comment": True,217 "create_and_map_document_comment": True,218 "read_document_comment": True,219 },220 "Universal DataAsset": {221 "create_and_map_document": True,222 "read_document": True,223 "update_document": True,224 "delete_document": False,225 "create_and_map_comment": True,226 "read_comment": True,227 "create_and_map_document_comment": True,228 "read_document_comment": True,229 },230 "Universal Facility": {231 "create_and_map_document": True,232 "read_document": True,233 "update_document": True,234 "delete_document": False,235 "create_and_map_comment": True,236 "read_comment": True,237 "create_and_map_document_comment": True,238 "read_document_comment": True,239 },240 "Universal Market": {241 "create_and_map_document": True,242 "read_document": True,243 "update_document": True,244 "delete_document": False,245 "create_and_map_comment": True,246 "read_comment": True,247 "create_and_map_document_comment": True,248 "read_document_comment": True,249 },250 "Universal Metric": {251 "create_and_map_document": True,252 "read_document": True,253 "update_document": True,254 "delete_document": False,255 "create_and_map_comment": True,256 "read_comment": True,257 "create_and_map_document_comment": True,258 "read_document_comment": True,259 },260 "Universal OrgGroup": {261 "create_and_map_document": True,262 "read_document": True,263 "update_document": True,264 "delete_document": False,265 "create_and_map_comment": True,266 "read_comment": True,267 "create_and_map_document_comment": True,268 "read_document_comment": True,269 },270 "Universal Process": {271 "create_and_map_document": True,272 "read_document": True,273 "update_document": True,274 "delete_document": False,275 "create_and_map_comment": True,276 "read_comment": True,277 "create_and_map_document_comment": True,278 "read_document_comment": True,279 },280 "Universal Product": {281 "create_and_map_document": True,282 "read_document": True,283 "update_document": True,284 "delete_document": False,285 "create_and_map_comment": True,286 "read_comment": True,287 "create_and_map_document_comment": True,288 "read_document_comment": True,289 },290 "Universal ProductGroup": {291 "create_and_map_document": True,292 "read_document": True,293 "update_document": True,294 "delete_document": False,295 "create_and_map_comment": True,296 "read_comment": True,297 "create_and_map_document_comment": True,298 "read_document_comment": True,299 },300 "Universal Project": {301 "create_and_map_document": True,302 "read_document": True,303 "update_document": True,304 "delete_document": False,305 "create_and_map_comment": True,306 "read_comment": True,307 "create_and_map_document_comment": True,308 "read_document_comment": True,309 },310 "Universal System": {311 "create_and_map_document": True,312 "read_document": True,313 "update_document": True,314 "delete_document": False,315 "create_and_map_comment": True,316 "read_comment": True,317 "create_and_map_document_comment": True,318 "read_document_comment": True,319 },320 "Universal TechnologyEnvironment": {321 "create_and_map_document": True,322 "read_document": True,323 "update_document": True,324 "delete_document": False,325 "create_and_map_comment": True,326 "read_comment": True,327 "create_and_map_document_comment": True,328 "read_document_comment": True,329 },330 "Universal Vendor": {331 "create_and_map_document": True,332 "read_document": True,333 "update_document": True,334 "delete_document": False,335 "create_and_map_comment": True,336 "read_comment": True,337 "create_and_map_document_comment": True,338 "read_document_comment": True,339 },340 "Universal KeyReport": {341 "create_and_map_document": True,342 "read_document": True,343 "update_document": True,344 "delete_document": False,345 "create_and_map_comment": True,346 "read_comment": True,347 "create_and_map_document_comment": True,348 "read_document_comment": True,349 },350 },351 "Editor": {352 "Universal AccessGroup": {353 "create_and_map_document": True,354 "read_document": True,355 "update_document": True,356 "delete_document": False,357 "create_and_map_comment": True,358 "read_comment": True,359 "create_and_map_document_comment": True,360 "read_document_comment": True,361 },362 "Universal DataAsset": {363 "create_and_map_document": True,364 "read_document": True,365 "update_document": True,366 "delete_document": False,367 "create_and_map_comment": True,368 "read_comment": True,369 "create_and_map_document_comment": True,370 "read_document_comment": True,371 },372 "Universal Facility": {373 "create_and_map_document": True,374 "read_document": True,375 "update_document": True,376 "delete_document": False,377 "create_and_map_comment": True,378 "read_comment": True,379 "create_and_map_document_comment": True,380 "read_document_comment": True,381 },382 "Universal Market": {383 "create_and_map_document": True,384 "read_document": True,385 "update_document": True,386 "delete_document": False,387 "create_and_map_comment": True,388 "read_comment": True,389 "create_and_map_document_comment": True,390 "read_document_comment": True,391 },392 "Universal Metric": {393 "create_and_map_document": True,394 "read_document": True,395 "update_document": True,396 "delete_document": False,397 "create_and_map_comment": True,398 "read_comment": True,399 "create_and_map_document_comment": True,400 "read_document_comment": True,401 },402 "Universal OrgGroup": {403 "create_and_map_document": True,404 "read_document": True,405 "update_document": True,406 "delete_document": False,407 "create_and_map_comment": True,408 "read_comment": True,409 "create_and_map_document_comment": True,410 "read_document_comment": True,411 },412 "Universal Process": {413 "create_and_map_document": True,414 "read_document": True,415 "update_document": True,416 "delete_document": False,417 "create_and_map_comment": True,418 "read_comment": True,419 "create_and_map_document_comment": True,420 "read_document_comment": True,421 },422 "Universal Product": {423 "create_and_map_document": True,424 "read_document": True,425 "update_document": True,426 "delete_document": False,427 "create_and_map_comment": True,428 "read_comment": True,429 "create_and_map_document_comment": True,430 "read_document_comment": True,431 },432 "Universal ProductGroup": {433 "create_and_map_document": True,434 "read_document": True,435 "update_document": True,436 "delete_document": False,437 "create_and_map_comment": True,438 "read_comment": True,439 "create_and_map_document_comment": True,440 "read_document_comment": True,441 },442 "Universal Project": {443 "create_and_map_document": True,444 "read_document": True,445 "update_document": True,446 "delete_document": False,447 "create_and_map_comment": True,448 "read_comment": True,449 "create_and_map_document_comment": True,450 "read_document_comment": True,451 },452 "Universal System": {453 "create_and_map_document": True,454 "read_document": True,455 "update_document": True,456 "delete_document": False,457 "create_and_map_comment": True,458 "read_comment": True,459 "create_and_map_document_comment": True,460 "read_document_comment": True,461 },462 "Universal TechnologyEnvironment": {463 "create_and_map_document": True,464 "read_document": True,465 "update_document": True,466 "delete_document": False,467 "create_and_map_comment": True,468 "read_comment": True,469 "create_and_map_document_comment": True,470 "read_document_comment": True,471 },472 "Universal Vendor": {473 "create_and_map_document": True,474 "read_document": True,475 "update_document": True,476 "delete_document": False,477 "create_and_map_comment": True,478 "read_comment": True,479 "create_and_map_document_comment": True,480 "read_document_comment": True,481 },482 "Universal KeyReport": {483 "create_and_map_document": True,484 "read_document": True,485 "update_document": True,486 "delete_document": False,487 "create_and_map_comment": True,488 "read_comment": True,489 "create_and_map_document_comment": True,490 "read_document_comment": True,491 },492 }493 }494 def init_factory(self, role, model, parent):495 """Initialize RBAC factory with propagated Primary Contacts role.496 Args:497 role: Global Custom role that user have (Creator/Reader/Editor).498 model: Model name for which factory should be got.499 parent: Model name in scope of which objects should be installed.500 Returns:501 Initialized RBACFactory object.502 """503 self.setup_people()504 primary_contacts = all_models.AccessControlRole.query.filter_by(505 name="Primary Contacts",506 object_type=parent,507 ).first()508 rbac_factory = rbac_factories.TEST_FACTORIES_MAPPING[model]509 return rbac_factory(self.people[role].id, primary_contacts, parent)510 @helpers.unwrap(PERMISSIONS)511 def test_access(self, role, model, action_name, expected_result):512 """Primary Contacts {0:<7}: On {1:<20} test {2:<20} - Expected {3:<2} """...
test_one_rank_verifier.py
Source:test_one_rank_verifier.py
1# Copyright (C) 2019 Google Inc.2# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>3"""Test Access Control roles Verifier propagation"""4import ddt5from ggrc.models import all_models6from integration.ggrc.access_control import rbac_factories7from integration.ggrc.access_control.acl_propagation import base8from integration.ggrc.utils import helpers9@ddt.ddt10class TestVerifierPropagation(base.TestACLPropagation):11 """Test Verifier role permissions propagation"""12 PERMISSIONS = {13 "Creator": {14 "Universal AccessGroup": {15 "create_and_map_document": True,16 "read_document": True,17 "update_document": True,18 "delete_document": False,19 "create_and_map_comment": True,20 "read_comment": True,21 "create_and_map_document_comment": True,22 "read_document_comment": True,23 },24 "Universal DataAsset": {25 "create_and_map_document": True,26 "read_document": True,27 "update_document": True,28 "delete_document": False,29 "create_and_map_comment": True,30 "read_comment": True,31 "create_and_map_document_comment": True,32 "read_document_comment": True,33 },34 "Universal Facility": {35 "create_and_map_document": True,36 "read_document": True,37 "update_document": True,38 "delete_document": False,39 "create_and_map_comment": True,40 "read_comment": True,41 "create_and_map_document_comment": True,42 "read_document_comment": True,43 },44 "Universal Market": {45 "create_and_map_document": True,46 "read_document": True,47 "update_document": True,48 "delete_document": False,49 "create_and_map_comment": True,50 "read_comment": True,51 "create_and_map_document_comment": True,52 "read_document_comment": True,53 },54 "Universal Metric": {55 "create_and_map_document": True,56 "read_document": True,57 "update_document": True,58 "delete_document": False,59 "create_and_map_comment": True,60 "read_comment": True,61 "create_and_map_document_comment": True,62 "read_document_comment": True,63 },64 "Universal OrgGroup": {65 "create_and_map_document": True,66 "read_document": True,67 "update_document": True,68 "delete_document": False,69 "create_and_map_comment": True,70 "read_comment": True,71 "create_and_map_document_comment": True,72 "read_document_comment": True,73 },74 "Universal Process": {75 "create_and_map_document": True,76 "read_document": True,77 "update_document": True,78 "delete_document": False,79 "create_and_map_comment": True,80 "read_comment": True,81 "create_and_map_document_comment": True,82 "read_document_comment": True,83 },84 "Universal Product": {85 "create_and_map_document": True,86 "read_document": True,87 "update_document": True,88 "delete_document": False,89 "create_and_map_comment": True,90 "read_comment": True,91 "create_and_map_document_comment": True,92 "read_document_comment": True,93 },94 "Universal ProductGroup": {95 "create_and_map_document": True,96 "read_document": True,97 "update_document": True,98 "delete_document": False,99 "create_and_map_comment": True,100 "read_comment": True,101 "create_and_map_document_comment": True,102 "read_document_comment": True,103 },104 "Universal Project": {105 "create_and_map_document": True,106 "read_document": True,107 "update_document": True,108 "delete_document": False,109 "create_and_map_comment": True,110 "read_comment": True,111 "create_and_map_document_comment": True,112 "read_document_comment": True,113 },114 "Universal System": {115 "create_and_map_document": True,116 "read_document": True,117 "update_document": True,118 "delete_document": False,119 "create_and_map_comment": True,120 "read_comment": True,121 "create_and_map_document_comment": True,122 "read_document_comment": True,123 },124 "Universal TechnologyEnvironment": {125 "create_and_map_document": True,126 "read_document": True,127 "update_document": True,128 "delete_document": False,129 "create_and_map_comment": True,130 "read_comment": True,131 "create_and_map_document_comment": True,132 "read_document_comment": True,133 },134 "Universal Vendor": {135 "create_and_map_document": True,136 "read_document": True,137 "update_document": True,138 "delete_document": False,139 "create_and_map_comment": True,140 "read_comment": True,141 "create_and_map_document_comment": True,142 "read_document_comment": True,143 },144 "Universal KeyReport": {145 "create_and_map_document": True,146 "read_document": True,147 "update_document": True,148 "delete_document": False,149 "create_and_map_comment": True,150 "read_comment": True,151 "create_and_map_document_comment": True,152 "read_document_comment": True,153 },154 },155 "Reader": {156 "Universal AccessGroup": {157 "create_and_map_document": True,158 "read_document": True,159 "update_document": True,160 "delete_document": False,161 "create_and_map_comment": True,162 "read_comment": True,163 "create_and_map_document_comment": True,164 "read_document_comment": True,165 },166 "Universal DataAsset": {167 "create_and_map_document": True,168 "read_document": True,169 "update_document": True,170 "delete_document": False,171 "create_and_map_comment": True,172 "read_comment": True,173 "create_and_map_document_comment": True,174 "read_document_comment": True,175 },176 "Universal Facility": {177 "create_and_map_document": True,178 "read_document": True,179 "update_document": True,180 "delete_document": False,181 "create_and_map_comment": True,182 "read_comment": True,183 "create_and_map_document_comment": True,184 "read_document_comment": True,185 },186 "Universal Market": {187 "create_and_map_document": True,188 "read_document": True,189 "update_document": True,190 "delete_document": False,191 "create_and_map_comment": True,192 "read_comment": True,193 "create_and_map_document_comment": True,194 "read_document_comment": True,195 },196 "Universal Metric": {197 "create_and_map_document": True,198 "read_document": True,199 "update_document": True,200 "delete_document": False,201 "create_and_map_comment": True,202 "read_comment": True,203 "create_and_map_document_comment": True,204 "read_document_comment": True,205 },206 "Universal OrgGroup": {207 "create_and_map_document": True,208 "read_document": True,209 "update_document": True,210 "delete_document": False,211 "create_and_map_comment": True,212 "read_comment": True,213 "create_and_map_document_comment": True,214 "read_document_comment": True,215 },216 "Universal Process": {217 "create_and_map_document": True,218 "read_document": True,219 "update_document": True,220 "delete_document": False,221 "create_and_map_comment": True,222 "read_comment": True,223 "create_and_map_document_comment": True,224 "read_document_comment": True,225 },226 "Universal Product": {227 "create_and_map_document": True,228 "read_document": True,229 "update_document": True,230 "delete_document": False,231 "create_and_map_comment": True,232 "read_comment": True,233 "create_and_map_document_comment": True,234 "read_document_comment": True,235 },236 "Universal ProductGroup": {237 "create_and_map_document": True,238 "read_document": True,239 "update_document": True,240 "delete_document": False,241 "create_and_map_comment": True,242 "read_comment": True,243 "create_and_map_document_comment": True,244 "read_document_comment": True,245 },246 "Universal Project": {247 "create_and_map_document": True,248 "read_document": True,249 "update_document": True,250 "delete_document": False,251 "create_and_map_comment": True,252 "read_comment": True,253 "create_and_map_document_comment": True,254 "read_document_comment": True,255 },256 "Universal System": {257 "create_and_map_document": True,258 "read_document": True,259 "update_document": True,260 "delete_document": False,261 "create_and_map_comment": True,262 "read_comment": True,263 "create_and_map_document_comment": True,264 "read_document_comment": True,265 },266 "Universal TechnologyEnvironment": {267 "create_and_map_document": True,268 "read_document": True,269 "update_document": True,270 "delete_document": False,271 "create_and_map_comment": True,272 "read_comment": True,273 "create_and_map_document_comment": True,274 "read_document_comment": True,275 },276 "Universal Vendor": {277 "create_and_map_document": True,278 "read_document": True,279 "update_document": True,280 "delete_document": False,281 "create_and_map_comment": True,282 "read_comment": True,283 "create_and_map_document_comment": True,284 "read_document_comment": True,285 },286 "Universal KeyReport": {287 "create_and_map_document": True,288 "read_document": True,289 "update_document": True,290 "delete_document": False,291 "create_and_map_comment": True,292 "read_comment": True,293 "create_and_map_document_comment": True,294 "read_document_comment": True,295 },296 },297 "Editor": {298 "Universal AccessGroup": {299 "create_and_map_document": True,300 "read_document": True,301 "update_document": True,302 "delete_document": False,303 "create_and_map_comment": True,304 "read_comment": True,305 "create_and_map_document_comment": True,306 "read_document_comment": True,307 },308 "Universal DataAsset": {309 "create_and_map_document": True,310 "read_document": True,311 "update_document": True,312 "delete_document": False,313 "create_and_map_comment": True,314 "read_comment": True,315 "create_and_map_document_comment": True,316 "read_document_comment": True,317 },318 "Universal Facility": {319 "create_and_map_document": True,320 "read_document": True,321 "update_document": True,322 "delete_document": False,323 "create_and_map_comment": True,324 "read_comment": True,325 "create_and_map_document_comment": True,326 "read_document_comment": True,327 },328 "Universal Market": {329 "create_and_map_document": True,330 "read_document": True,331 "update_document": True,332 "delete_document": False,333 "create_and_map_comment": True,334 "read_comment": True,335 "create_and_map_document_comment": True,336 "read_document_comment": True,337 },338 "Universal Metric": {339 "create_and_map_document": True,340 "read_document": True,341 "update_document": True,342 "delete_document": False,343 "create_and_map_comment": True,344 "read_comment": True,345 "create_and_map_document_comment": True,346 "read_document_comment": True,347 },348 "Universal OrgGroup": {349 "create_and_map_document": True,350 "read_document": True,351 "update_document": True,352 "delete_document": False,353 "create_and_map_comment": True,354 "read_comment": True,355 "create_and_map_document_comment": True,356 "read_document_comment": True,357 },358 "Universal Process": {359 "create_and_map_document": True,360 "read_document": True,361 "update_document": True,362 "delete_document": False,363 "create_and_map_comment": True,364 "read_comment": True,365 "create_and_map_document_comment": True,366 "read_document_comment": True,367 },368 "Universal Product": {369 "create_and_map_document": True,370 "read_document": True,371 "update_document": True,372 "delete_document": False,373 "create_and_map_comment": True,374 "read_comment": True,375 "create_and_map_document_comment": True,376 "read_document_comment": True,377 },378 "Universal ProductGroup": {379 "create_and_map_document": True,380 "read_document": True,381 "update_document": True,382 "delete_document": False,383 "create_and_map_comment": True,384 "read_comment": True,385 "create_and_map_document_comment": True,386 "read_document_comment": True,387 },388 "Universal Project": {389 "create_and_map_document": True,390 "read_document": True,391 "update_document": True,392 "delete_document": False,393 "create_and_map_comment": True,394 "read_comment": True,395 "create_and_map_document_comment": True,396 "read_document_comment": True,397 },398 "Universal System": {399 "create_and_map_document": True,400 "read_document": True,401 "update_document": True,402 "delete_document": False,403 "create_and_map_comment": True,404 "read_comment": True,405 "create_and_map_document_comment": True,406 "read_document_comment": True,407 },408 "Universal TechnologyEnvironment": {409 "create_and_map_document": True,410 "read_document": True,411 "update_document": True,412 "delete_document": False,413 "create_and_map_comment": True,414 "read_comment": True,415 "create_and_map_document_comment": True,416 "read_document_comment": True,417 },418 "Universal Vendor": {419 "create_and_map_document": True,420 "read_document": True,421 "update_document": True,422 "delete_document": False,423 "create_and_map_comment": True,424 "read_comment": True,425 "create_and_map_document_comment": True,426 "read_document_comment": True,427 },428 "Universal KeyReport": {429 "create_and_map_document": True,430 "read_document": True,431 "update_document": True,432 "delete_document": False,433 "create_and_map_comment": True,434 "read_comment": True,435 "create_and_map_document_comment": True,436 "read_document_comment": True,437 },438 }439 }440 def init_factory(self, role, model, parent):441 """Initialize RBAC factory with propagated Verifier role.442 Args:443 role: Global Custom role that user have (Creator/Reader/Editor).444 model: Model name for which factory should be got.445 parent: Model name in scope of which objects should be installed.446 Returns:447 Initialized RBACFactory object.448 """449 self.setup_people()450 primary_contacts = all_models.AccessControlRole.query.filter_by(451 name="Verifier",452 object_type=parent,453 ).first()454 rbac_factory = rbac_factories.TEST_FACTORIES_MAPPING[model]455 return rbac_factory(self.people[role].id, primary_contacts, parent)456 @helpers.unwrap(PERMISSIONS)457 def test_access(self, role, model, action_name, expected_result):458 """Primary Contacts {0:<7}: On {1:<20} test {2:<20} - Expected {3:<2} """...
mongo_db.py
Source:mongo_db.py
...4def get_document(query_dict):5 return db_doc.find_one(query_dict)6def create_document(new_dict):7 db_doc.insert_one(new_dict)8def update_document(query_dict, update_data):9 return db_doc.update_one(query_dict, {"$set":update_data}).modified_count != 010def main():11 # Testing12 query = {"title":"None"}13 new_data = {"title":"testtest"}14 print(f"DEBUG get_document: {get_document(query)}")15 create_document(query)16 print(f"DEBUG get_document: {get_document(query)}")17 print(f"DEBUG update_document: {update_document(query, new_data)}")18 print(f"DEBUG get_document: {get_document(query)}")19 print(f"DEBUG get_document: {get_document(new_data)}")20 print(f"DEBUG update_document: {update_document(query, new_data)}")21if __name__ == "__main__":...
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!!