This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - az: | |
| description: "Deploy logic app" | |
| arguments: | |
| - functionapp | |
| - deployment | |
| - source | |
| - config-zip | |
| flags: | |
| name: "{{ bundle.outputs.airlock_notifier_logic_app_name }}" | |
| resource-group: "{{ bundle.outputs.airlock_notifier_logic_app_resource_group_name }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "azurerm_resource_group_template_deployment" "smtp_api_connection_access_policy" { | |
| name = "smtp-api-connection-access-policy" | |
| resource_group_name = data.azurerm_resource_group.core.name | |
| template_content = data.local_file.smtp_access_policy.content | |
| parameters_content = jsonencode({ | |
| "servicePrincipalId" = { | |
| value = azurerm_logic_app_standard.logic_app.identity.0.principal_id | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "azurerm_logic_app_standard" "logic_app" { | |
| name = "airlock-notifier-app-${var.tre_id}" | |
| location = data.azurerm_resource_group.core.location | |
| resource_group_name = data.azurerm_resource_group.core.name | |
| app_service_plan_id = azurerm_service_plan.notifier_plan.id | |
| storage_account_name = data.azurerm_storage_account.storage.name | |
| storage_account_access_key = data.azurerm_storage_account.storage.primary_access_key | |
| app_settings = { | |
| "FUNCTIONS_WORKER_RUNTIME" = "node" | |
| "WEBSITE_NODE_DEFAULT_VERSION" = "~12" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "azurerm_resource_group_template_deployment" "smtp_api_connection" { | |
| name = "smtp-api-connection" | |
| resource_group_name = data.azurerm_resource_group.core.name | |
| template_content = data.local_file.smtp_api_connection.content | |
| parameters_content = jsonencode({ | |
| "serverAddress" = { | |
| value = var.smtp_server_address | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import unittest | |
| from unittest.mock import patch, MagicMock | |
| from starlette.testclient import TestClient | |
| from app.dao.book_dao import BookDao | |
| from app.model.book import Book | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def test_when_getting_book_by_id_then_dao_get_by_id_called_once( | |
| self, | |
| ): | |
| self.book_dao.get_by_id.return_value = _get_default_book() | |
| self.client.get(f"book/non_default_id") | |
| print(self.book_dao.get_by_id.call_count, self.book_dao.get_by_id.call_args_list) | |
| # prints 2 ,[call('id'), call('non_default_id')] | |
| self.assertEquals(self.book_dao.get_by_id.call_count, 1) # AssertionError: 2 != 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import unittest | |
| from unittest.mock import patch, MagicMock | |
| from starlette.testclient import TestClient | |
| from app.dao.book_dao import BookDao | |
| from app.model.book import Book | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def test_when_getting_book_by_id_then_dao_get_by_id_called( | |
| self, | |
| ): | |
| book = _get_default_book() | |
| self.book_dao.get_by_id.return_value = book | |
| response = self.client.get(f"book/{book.id}") | |
| self.assertEquals(response.status_code, 200) | |
| self.assertEquals(response.json(), book) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import unittest | |
| from unittest.mock import patch, MagicMock | |
| from starlette.testclient import TestClient | |
| from app.dao.book_dao import BookDao | |
| from app.model.book import Book | |
| class TestMain(unittest.TestCase): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import unittest | |
| from unittest.mock import patch | |
| from starlette.testclient import TestClient | |
| from app.main import app | |
| from app.model.book import Book | |
| @patch("app.dao.book_dao.BookDao") # Mock BookDao to make sure it is not actually called |
NewerOlder