You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With simulated authentication, the method `has_permission` simply returns the value given in `should_satisfy_all` property in the permission request.
273
+
274
+
275
+
### Testing
276
+
277
+
The project is configured with `python` to figure out the coverage of the unit tests. All the tests are in `tests` folder.
278
+
- To execute the tests, please follow the commands:
279
+
280
+
`pip install -r requirements.txt`
281
+
282
+
`unittest discover -v tests/unit_tests`
283
+
284
+
- To execute the code coverage, please follow the commands:
285
+
286
+
`coverage run --source=src/python_ms_core -m unittest discover -v tests/unit_tests`
287
+
288
+
`coverage html` // Can be run after 1st command
289
+
290
+
`coverage report` // Can be run after 1st command
291
+
292
+
- After the commands are run, you can check the coverage report in `htmlcov/index.html`. Open the file in any browser, and it shows complete coverage details
293
+
- The terminal will show the output of coverage like this
294
+
```shell
295
+
296
+
> coverage run --source=src/python_ms_core -m unittest discover -v tests/unit_tests
297
+
test_has_permission (test_auth.abstract.test_authorizer_abstraction.TestAuthorizerAbstract) ... ok
298
+
test_get_search_params (test_auth.models.test_permission_request.TestPermissionRequest) ... ok
299
+
test_has_permission_with_invalid_permissions (test_auth.provider.test_hosted_authorizer.TestHostedAuthorizer) ... ok
300
+
test_has_permission_with_missing_auth_url (test_auth.provider.test_hosted_authorizer.TestHostedAuthorizer) ... ok
301
+
test_has_permission_with_valid_permissions (test_auth.provider.test_hosted_authorizer.TestHostedAuthorizer) ... ok
302
+
test_has_permission_should_return_should_satisfy_all (test_auth.provider.test_simulated_authorizer.TestSimulatedAuthorizer) ... ok
303
+
test_has_permission_should_return_should_satisfy_none (test_auth.provider.test_simulated_authorizer.TestSimulatedAuthorizer) ... ok
304
+
test_core_config_auth (test_config.test_cofig.TestCoreConfig) ... ok
305
+
test_core_config_auth_url (test_config.test_cofig.TestCoreConfig) ... ok
306
+
test_core_config_auth_url_default (test_config.test_cofig.TestCoreConfig) ... ok
307
+
test_core_config_logger (test_config.test_cofig.TestCoreConfig) ... ok
308
+
test_core_config_provider (test_config.test_cofig.TestCoreConfig) ... ok
309
+
test_core_config_provider_default (test_config.test_cofig.TestCoreConfig) ... ok
310
+
test_core_config_provider_override (test_config.test_cofig.TestCoreConfig) ... ok
311
+
test_core_config_queue (test_config.test_cofig.TestCoreConfig) ... ok
312
+
test_core_config_queue_connection (test_config.test_cofig.TestCoreConfig) ... ok
313
+
test_core_config_queue_connection_default (test_config.test_cofig.TestCoreConfig) ... ok
314
+
test_core_config_queue_name (test_config.test_cofig.TestCoreConfig) ... ok
315
+
test_core_config_queue_name_default (test_config.test_cofig.TestCoreConfig) ... ok
316
+
test_core_config_storage (test_config.test_cofig.TestCoreConfig) ... ok
317
+
test_core_config_storage_connection (test_config.test_cofig.TestCoreConfig) ... ok
318
+
test_core_config_storage_connection_default (test_config.test_cofig.TestCoreConfig) ... ok
319
+
test_core_config_topic (test_config.test_cofig.TestCoreConfig) ... ok
320
+
test_core_config_topic_connection (test_config.test_cofig.TestCoreConfig) ... ok
321
+
test_core_config_topic_connection_default (test_config.test_cofig.TestCoreConfig) ... ok
322
+
test_local_config_auth (test_config.test_cofig.TestLocalConfig) ... ok
323
+
test_local_config_logger (test_config.test_cofig.TestLocalConfig) ... ok
324
+
test_local_config_provider (test_config.test_cofig.TestLocalConfig) ... ok
325
+
test_local_config_provider_default (test_config.test_cofig.TestLocalConfig) ... ok
326
+
test_local_config_queue (test_config.test_cofig.TestLocalConfig) ... ok
327
+
test_local_config_queue_connection (test_config.test_cofig.TestLocalConfig) ... ok
328
+
test_local_config_queue_connection_default (test_config.test_cofig.TestLocalConfig) ... ok
329
+
test_local_config_queue_name (test_config.test_cofig.TestLocalConfig) ... ok
330
+
test_local_config_queue_name_default (test_config.test_cofig.TestLocalConfig) ... ok
331
+
test_local_config_storage (test_config.test_cofig.TestLocalConfig) ... ok
332
+
test_local_config_storage_connection (test_config.test_cofig.TestLocalConfig) ... ok
333
+
test_local_config_storage_connection_default (test_config.test_cofig.TestLocalConfig) ... ok
334
+
test_local_config_topic (test_config.test_cofig.TestLocalConfig) ... ok
335
+
test_local_config_topic_connection (test_config.test_cofig.TestLocalConfig) ... ok
336
+
test_local_config_topic_connection_default (test_config.test_cofig.TestLocalConfig) ... ok
337
+
test_local_config_auth (test_config.test_cofig.TestUnknownConfig) ... ok
338
+
test_unknown_config_logger (test_config.test_cofig.TestUnknownConfig) ... ok
339
+
test_unknown_config_provider (test_config.test_cofig.TestUnknownConfig) ... ok
340
+
test_unknown_config_queue (test_config.test_cofig.TestUnknownConfig) ... ok
341
+
test_unknown_config_queue_connection_default (test_config.test_cofig.TestUnknownConfig) ... ok
342
+
test_unknown_config_queue_name_default (test_config.test_cofig.TestUnknownConfig) ... ok
343
+
test_unknown_config_storage (test_config.test_cofig.TestUnknownConfig) ... ok
344
+
test_unknown_config_storage_connection_default (test_config.test_cofig.TestUnknownConfig) ... ok
345
+
test_unknown_config_topic (test_config.test_cofig.TestUnknownConfig) ... ok
346
+
test_unknown_config_topic_connection_default (test_config.test_cofig.TestUnknownConfig) ... ok
347
+
test_get_authorizer_no_config (test_core.TestCore) ... 2023-07-03 18:07:41 ERROR Failed to initialization core.get_logger for provider: SIMULATED
348
+
ok
349
+
test_get_authorizer_with_config_hosted_provider (test_core.TestCore) ... 2023-07-03 18:07:41 ERROR Failed to initialization core.get_logger for provider: AZURE
350
+
ok
351
+
test_get_authorizer_with_config_simulated_provider (test_core.TestCore) ... 2023-07-03 18:07:41 ERROR Failed to initialization core.get_logger for provider: SIMULATED
352
+
ok
353
+
test_get_authorizer_with_config_unknown_provider (test_core.TestCore) ... 2023-07-03 18:07:41 ERROR Failed to initialization core.get_logger for provider: UNKNOWN
354
+
ok
355
+
test_get_logger_azure_provider (test_core.TestCore) ... 2023-07-03 18:07:41 ERROR Failed to initialization core.get_logger for provider: AZURE
356
+
ok
357
+
test_get_logger_local_provider (test_core.TestCore) ... ok
358
+
test_get_logger_unknown_provider (test_core.TestCore) ... 2023-07-03 18:07:41 ERROR Failed to initialization core.get_logger for provider: UNKNOWN
359
+
ok
360
+
test_get_storage_client_azure_provider (test_core.TestCore) ... 2023-07-03 18:07:41 ERROR Failed to initialization core.get_logger for provider: AZURE
361
+
ok
362
+
test_get_storage_client_local_provider (test_core.TestCore) ... ok
363
+
test_get_storage_client_unknown_provider (test_core.TestCore) ... 2023-07-03 18:07:41 ERROR Failed to initialization core.get_logger for provider: UNKNOWN
364
+
ok
365
+
test_get_topic_azure_provider (test_core.TestCore) ... 2023-07-03 18:07:41 ERROR Failed to initialization core.get_logger for provider: AZURE
366
+
ok
367
+
test_get_topic_local_provider (test_core.TestCore) ... ok
368
+
test_get_topic_unknown_provider (test_core.TestCore) ... 2023-07-03 18:07:41 ERROR Failed to initialization core.get_logger for provider: UNKNOWN
369
+
ok
370
+
test_add_request (test_logger.abstract.test_logger_abstract.TestLoggerAbstract) ... ok
371
+
test_debug (test_logger.abstract.test_logger_abstract.TestLoggerAbstract) ... ok
372
+
test_error (test_logger.abstract.test_logger_abstract.TestLoggerAbstract) ... ok
373
+
test_info (test_logger.abstract.test_logger_abstract.TestLoggerAbstract) ... ok
374
+
test_record_metric (test_logger.abstract.test_logger_abstract.TestLoggerAbstract) ... ok
375
+
test_warn (test_logger.abstract.test_logger_abstract.TestLoggerAbstract) ... ok
376
+
test_add_request (test_logger.test_local_logger.TestLocalLogger) ... ok
377
+
test_debug (test_logger.test_local_logger.TestLocalLogger) ... ok
378
+
test_error (test_logger.test_local_logger.TestLocalLogger) ... ok
379
+
test_info (test_logger.test_local_logger.TestLocalLogger) ... ok
380
+
test_record_metric (test_logger.test_local_logger.TestLocalLogger) ... ok
381
+
test_warn (test_logger.test_local_logger.TestLocalLogger) ... ok
382
+
test_add_request (test_logger.test_logger.TestLogger) ... ok
383
+
test_debug (test_logger.test_logger.TestLogger) ... ok
384
+
test_error (test_logger.test_logger.TestLogger) ... ok
385
+
test_info (test_logger.test_logger.TestLogger) ... ok
386
+
test_record_metric (test_logger.test_logger.TestLogger) ... ok
387
+
test_warn (test_logger.test_logger.TestLogger) ... ok
388
+
test_concrete_queue_has_abstract_methods_implemented (test_queue.abstract.test_queue_abstract.TestQueueAbstract) ... ok
389
+
test_concrete_queue_inherits_from_queue_abstract (test_queue.abstract.test_queue_abstract.TestQueueAbstract) ... ok
390
+
test_azure_provider_invalid_connection_string (test_queue.config.test_queue_config.TestConfig) ... ok
391
+
test_azure_provider_missing_queue_name (test_queue.config.test_queue_config.TestConfig) ... ok
392
+
test_azure_provider_valid_connection_string (test_queue.config.test_queue_config.TestConfig) ... ok
393
+
test_non_azure_provider (test_queue.config.test_queue_config.TestConfig) ... ok
394
+
test_add_message_to_queue (test_queue.models.test_queue_message.QueueMessageTestCase) ... ok
395
+
test_add_message_to_queue_no_data (test_queue.models.test_queue_message.QueueMessageTestCase) ... ok
396
+
test_data_from_invalid_string (test_queue.models.test_queue_message.QueueMessageTestCase) ... ok
397
+
test_data_from_valid_string (test_queue.models.test_queue_message.QueueMessageTestCase) ... ok
398
+
test_get_items (test_queue.models.test_queue_message.QueueMessageTestCase) ... ok
399
+
test_remove_message_from_empty_queue (test_queue.models.test_queue_message.QueueMessageTestCase) ... ok
400
+
test_remove_message_from_queue (test_queue.models.test_queue_message.QueueMessageTestCase) ... ok
401
+
test_send_queue (test_queue.models.test_queue_message.QueueMessageTestCase) ... ok
402
+
test_to_dict (test_queue.models.test_queue_message.QueueMessageTestCase) ... ok
403
+
test_validate_data (test_queue.models.test_queue_message.QueueMessageTestCase) ... ok
404
+
test_validate_data_invalid_type (test_queue.models.test_queue_message.QueueMessageTestCase) ... ok
405
+
test_validate_string (test_queue.models.test_queue_message.QueueMessageTestCase) ... ok
406
+
test_validate_string_invalid_type (test_queue.models.test_queue_message.QueueMessageTestCase) ... ok
407
+
test_add_message_to_queue (test_queue.test_local_queue.TestLocalQueue) ... ok
408
+
test_add_message_to_queue_with_no_data (test_queue.test_local_queue.TestLocalQueue) ... ok
409
+
test_empty_queue (test_queue.test_local_queue.TestLocalQueue) ... ok
410
+
test_get_items_from_queue (test_queue.test_local_queue.TestLocalQueue) ... ok
411
+
test_remove_message_from_queue (test_queue.test_local_queue.TestLocalQueue) ... ok
0 commit comments