diff --git a/Pipfile b/Pipfile index a99d68e0..42f3dc48 100644 --- a/Pipfile +++ b/Pipfile @@ -24,7 +24,7 @@ pytest-mock = "*" djangorestframework = "~=3.15.2" django-environ = "~=0.4" django-model-utils = "~=4.0" -sentry-sdk = "~=2.8.0" +sentry-sdk = "~=1.45.1" typed-ast = "~=1.4.2" mohawk = ">=1.1" python-dateutil = "~=2.8" diff --git a/Pipfile.lock b/Pipfile.lock index 3ea6f1ff..a168aae9 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "0bad3e91046e881a8b218a0dd6df5429a318f9914269af66df481bcc1a45d30a" + "sha256": "1c532716d28609c6f5c08768d85fee147af19151e9bdcba6e729dcd65e4393bb" }, "pipfile-spec": 6, "requires": { @@ -485,11 +485,11 @@ }, "faker": { "hashes": [ - "sha256:1c925fc0e86a51fc46648b504078c88d0cd48da1da2595c4e712841cab43a1e4", - "sha256:d30c5f0e2796b8970de68978365247657486eb0311c5abe88d0b895b68dff05d" + "sha256:2abb551a05b75d268780b6095100a48afc43c53e97422002efbfc1272ebf5f26", + "sha256:ae074d9c7ef65817a93b448141a5531a16b2ea2e563dc5774578197c7c84060c" ], "markers": "python_version >= '3.8'", - "version": "==33.1.0" + "version": "==33.3.0" }, "filelock": { "hashes": [ @@ -509,64 +509,64 @@ }, "grpcio": { "hashes": [ - "sha256:025f790c056815b3bf53da850dd70ebb849fd755a4b1ac822cb65cd631e37d43", - "sha256:04cfd68bf4f38f5bb959ee2361a7546916bd9a50f78617a346b3aeb2b42e2161", - "sha256:0feb02205a27caca128627bd1df4ee7212db051019a9afa76f4bb6a1a80ca95e", - "sha256:1098f03dedc3b9810810568060dea4ac0822b4062f537b0f53aa015269be0a76", - "sha256:12941d533f3cd45d46f202e3667be8ebf6bcb3573629c7ec12c3e211d99cfccf", - "sha256:255b1635b0ed81e9f91da4fcc8d43b7ea5520090b9a9ad9340d147066d1d3613", - "sha256:298ee7f80e26f9483f0b6f94cc0a046caf54400a11b644713bb5b3d8eb387600", - "sha256:2c4cec6177bf325eb6faa6bd834d2ff6aa8bb3b29012cceb4937b86f8b74323c", - "sha256:2cc1fd04af8399971bcd4f43bd98c22d01029ea2e56e69c34daf2bf8470e47f5", - "sha256:334ab917792904245a028f10e803fcd5b6f36a7b2173a820c0b5b076555825e1", - "sha256:3522c77d7e6606d6665ec8d50e867f13f946a4e00c7df46768f1c85089eae515", - "sha256:37ea3be171f3cf3e7b7e412a98b77685eba9d4fd67421f4a34686a63a65d99f9", - "sha256:390eee4225a661c5cd133c09f5da1ee3c84498dc265fd292a6912b65c421c78c", - "sha256:3aed6544e4d523cd6b3119b0916cef3d15ef2da51e088211e4d1eb91a6c7f4f1", - "sha256:3ceb56c4285754e33bb3c2fa777d055e96e6932351a3082ce3559be47f8024f0", - "sha256:44a8502dd5de653ae6a73e2de50a401d84184f0331d0ac3daeb044e66d5c5054", - "sha256:4b177f5547f1b995826ef529d2eef89cca2f830dd8b2c99ffd5fde4da734ba73", - "sha256:4efac5481c696d5cb124ff1c119a78bddbfdd13fc499e3bc0ca81e95fc573684", - "sha256:52fbf85aa71263380d330f4fce9f013c0798242e31ede05fcee7fbe40ccfc20d", - "sha256:55857c71641064f01ff0541a1776bfe04a59db5558e82897d35a7793e525774c", - "sha256:66a24f3d45c33550703f0abb8b656515b0ab777970fa275693a2f6dc8e35f1c1", - "sha256:6ab2d912ca39c51f46baf2a0d92aa265aa96b2443266fc50d234fa88bf877d8e", - "sha256:77d65165fc35cff6e954e7fd4229e05ec76102d4406d4576528d3a3635fc6172", - "sha256:7dfc914cc31c906297b30463dde0b9be48e36939575eaf2a0a22a8096e69afe5", - "sha256:7f20ebec257af55694d8f993e162ddf0d36bd82d4e57f74b31c67b3c6d63d8b2", - "sha256:80af6f1e69c5e68a2be529990684abdd31ed6622e988bf18850075c81bb1ad6e", - "sha256:83bbf5807dc3ee94ce1de2dfe8a356e1d74101e4b9d7aa8c720cc4818a34aded", - "sha256:8720c25cd9ac25dd04ee02b69256d0ce35bf8a0f29e20577427355272230965a", - "sha256:8829924fffb25386995a31998ccbbeaa7367223e647e0122043dfc485a87c666", - "sha256:8a3869a6661ec8f81d93f4597da50336718bde9eb13267a699ac7e0a1d6d0bea", - "sha256:8cb620037a2fd9eeee97b4531880e439ebfcd6d7d78f2e7dcc3726428ab5ef63", - "sha256:919d7f18f63bcad3a0f81146188e90274fde800a94e35d42ffe9eadf6a9a6330", - "sha256:95c87ce2a97434dffe7327a4071839ab8e8bffd0054cc74cbe971fba98aedd60", - "sha256:963cc8d7d79b12c56008aabd8b457f400952dbea8997dd185f155e2f228db079", - "sha256:96f473cdacfdd506008a5d7579c9f6a7ff245a9ade92c3c0265eb76cc591914f", - "sha256:9d1fae6bbf0816415b81db1e82fb3bf56f7857273c84dcbe68cbe046e58e1ccd", - "sha256:a0c8ddabef9c8f41617f213e527254c41e8b96ea9d387c632af878d05db9229c", - "sha256:a1b988b40f2fd9de5c820f3a701a43339d8dcf2cb2f1ca137e2c02671cc83ac1", - "sha256:a47faedc9ea2e7a3b6569795c040aae5895a19dde0c728a48d3c5d7995fda385", - "sha256:a8040f85dcb9830d8bbb033ae66d272614cec6faceee88d37a88a9bd1a7a704e", - "sha256:b33bd114fa5a83f03ec6b7b262ef9f5cac549d4126f1dc702078767b10c46ed9", - "sha256:c08079b4934b0bf0a8847f42c197b1d12cba6495a3d43febd7e99ecd1cdc8d54", - "sha256:c28848761a6520c5c6071d2904a18d339a796ebe6b800adc8b3f474c5ce3c3ad", - "sha256:cb400138e73969eb5e0535d1d06cae6a6f7a15f2cc74add320e2130b8179211a", - "sha256:cbb5780e2e740b6b4f2d208e90453591036ff80c02cc605fea1af8e6fc6b1bbe", - "sha256:ccf2ebd2de2d6661e2520dae293298a3803a98ebfc099275f113ce1f6c2a80f1", - "sha256:d35740e3f45f60f3c37b1e6f2f4702c23867b9ce21c6410254c9c682237da68d", - "sha256:d99abcd61760ebb34bdff37e5a3ba333c5cc09feda8c1ad42547bea0416ada78", - "sha256:ddda1aa22495d8acd9dfbafff2866438d12faec4d024ebc2e656784d96328ad0", - "sha256:dffd29a2961f3263a16d73945b57cd44a8fd0b235740cb14056f0612329b345e", - "sha256:e4842e4872ae4ae0f5497bf60a0498fa778c192cc7a9e87877abd2814aca9475", - "sha256:e8dbe3e00771bfe3d04feed8210fc6617006d06d9a2679b74605b9fed3e8362c", - "sha256:ee2e743e51cb964b4975de572aa8fb95b633f496f9fcb5e257893df3be854746", - "sha256:eeb38ff04ab6e5756a2aef6ad8d94e89bb4a51ef96e20f45c44ba190fa0bcaad", - "sha256:f8261fa2a5f679abeb2a0a93ad056d765cdca1c47745eda3f2d87f874ff4b8c9" + "sha256:01f834732c22a130bdf3dc154d1053bdbc887eb3ccb7f3e6285cfbfc33d9d5cc", + "sha256:028337786f11fecb5d7b7fa660475a06aabf7e5e52b5ac2df47414878c0ce7ea", + "sha256:0470fa911c503af59ec8bc4c82b371ee4303ececbbdc055f55ce48e38b20fd67", + "sha256:0f0270bd9ffbff6961fe1da487bdcd594407ad390cc7960e738725d4807b18c4", + "sha256:1227ff7836f7b3a4ab04e5754f1d001fa52a730685d3dc894ed8bc262cc96c01", + "sha256:1514341def9c6ec4b7f0b9628be95f620f9d4b99331b7ef0a1845fd33d9b579c", + "sha256:1e925954b18d41aeb5ae250262116d0970893b38232689c4240024e4333ac084", + "sha256:1ee76cd7e2e49cf9264f6812d8c9ac1b85dda0eaea063af07292400f9191750e", + "sha256:1f03dc9b4da4c0dc8a1db7a5420f575251d7319b7a839004d8916257ddbe4816", + "sha256:200e48a6e7b00f804cf00a1c26292a5baa96507c7749e70a3ec10ca1a288936e", + "sha256:2060ca95a8db295ae828d0fc1c7f38fb26ccd5edf9aa51a0f44251f5da332e97", + "sha256:26c9a9c4ac917efab4704b18eed9082ed3b6ad19595f047e8173b5182fec0d5e", + "sha256:282f47d0928e40f25d007f24eb8fa051cb22551e3c74b8248bc9f9bea9c35fe0", + "sha256:2e52e107261fd8fa8fa457fe44bfadb904ae869d87c1280bf60f93ecd3e79278", + "sha256:316463c0832d5fcdb5e35ff2826d9aa3f26758d29cdfb59a368c1d6c39615a11", + "sha256:3629d8a8185f5139869a6a17865d03113a260e311e78fbe313f1a71603617589", + "sha256:3b75aea7c6cb91b341c85e7c1d9db1e09e1dd630b0717f836be94971e015031e", + "sha256:45a4704339b6e5b24b0e136dea9ad3815a94f30eb4f1e1d44c4ac484ef11d8dd", + "sha256:4ed866f9edb574fd9be71bf64c954ce1b88fc93b2a4cbf94af221e9426eb14d6", + "sha256:5494d0e52bf77a2f7eb17c6da662886ca0a731e56c1c85b93505bece8dc6cf4c", + "sha256:5ccbed100dc43704e94ccff9e07680b540d64e4cc89213ab2832b51b4f68a520", + "sha256:5cfd14175f9db33d4b74d63de87c64bb0ee29ce475ce3c00c01ad2a3dc2a9e51", + "sha256:60e5de105dc02832dc8f120056306d0ef80932bcf1c0e2b4ca3b676de6dc6505", + "sha256:7e76accf38808f5c5c752b0ab3fd919eb14ff8fafb8db520ad1cc12afff74de6", + "sha256:85d347cb8237751b23539981dbd2d9d8f6e9ff90082b427b13022b948eb6347a", + "sha256:87d222569273720366f68a99cb62e6194681eb763ee1d3b1005840678d4884f9", + "sha256:8b94e83f66dbf6fd642415faca0608590bc5e8d30e2c012b31d7d1b91b1de2fd", + "sha256:8cc614e895177ab7e4b70f154d1a7c97e152577ea101d76026d132b7aaba003b", + "sha256:8de1b192c29b8ce45ee26a700044717bcbbd21c697fa1124d440548964328561", + "sha256:9031069d36cb949205293cf0e243abd5e64d6c93e01b078c37921493a41b72dc", + "sha256:90b3646ced2eae3a0599658eeccc5ba7f303bf51b82514c50715bdd2b109e5ec", + "sha256:936fa44241b5379c5afc344e1260d467bee495747eaf478de825bab2791da6f5", + "sha256:a78a06911d4081a24a1761d16215a08e9b6d4d29cdbb7e427e6c7e17b06bcc5d", + "sha256:a7f4ed0dcf202a70fe661329f8874bc3775c14bb3911d020d07c82c766ce0eb1", + "sha256:b192b81076073ed46f4b4dd612b8897d9a1e39d4eabd822e5da7b38497ed77e1", + "sha256:b62b0f41e6e01a3e5082000b612064c87c93a49b05f7602fe1b7aa9fd5171a1d", + "sha256:b634851b92c090763dde61df0868c730376cdb73a91bcc821af56ae043b09596", + "sha256:b650f34aceac8b2d08a4c8d7dc3e8a593f4d9e26d86751ebf74ebf5107d927de", + "sha256:b7f693db593d6bf285e015d5538bf1c86cf9c60ed30b6f7da04a00ed052fe2f3", + "sha256:bf1f8be0da3fcdb2c1e9f374f3c2d043d606d69f425cd685110dd6d0d2d61258", + "sha256:bf5f680d3ed08c15330d7830d06bc65f58ca40c9999309517fd62880d70cb06e", + "sha256:c1fea55d26d647346acb0069b08dca70984101f2dc95066e003019207212e303", + "sha256:c5ba38aeac7a2fe353615c6b4213d1fbb3a3c34f86b4aaa8be08baaaee8cc56d", + "sha256:c9a281878feeb9ae26db0622a19add03922a028d4db684658f16d546601a4870", + "sha256:ca71d73a270dff052fe4edf74fef142d6ddd1f84175d9ac4a14b7280572ac519", + "sha256:cc89b6c29f3dccbe12d7a3b3f1b3999db4882ae076c1c1f6df231d55dbd767a5", + "sha256:cd7ea241b10bc5f0bb0f82c0d7896822b7ed122b3ab35c9851b440c1ccf81588", + "sha256:d5658c3c2660417d82db51e168b277e0ff036d0b0f859fa7576c0ffd2aec1442", + "sha256:db6f9fd2578dbe37db4b2994c94a1d9c93552ed77dca80e1657bb8a05b898b55", + "sha256:dc48f99cc05e0698e689b51a05933253c69a8c8559a47f605cff83801b03af0e", + "sha256:dc5a351927d605b2721cbb46158e431dd49ce66ffbacb03e709dc07a491dde35", + "sha256:dd034d68a2905464c49479b0c209c773737a4245d616234c79c975c7c90eca03", + "sha256:f79e05f5bbf551c4057c227d1b041ace0e78462ac8128e2ad39ec58a382536d2", + "sha256:fb9302afc3a0e4ba0b225cd651ef8e478bf0070cf11a529175caecd5ea2474e7", + "sha256:fc18a4de8c33491ad6f70022af5c460b39611e39578a4d84de0fe92f12d5d47b" ], "markers": "python_version >= '3.8'", - "version": "==1.68.1" + "version": "==1.69.0" }, "gunicorn": { "hashes": [ @@ -579,11 +579,11 @@ }, "identify": { "hashes": [ - "sha256:285a7d27e397652e8cafe537a6cc97dd470a970f48fb2e9d979aa38eae5513ac", - "sha256:993b0f01b97e0568c179bb9196391ff391bfb88a99099dbf5ce392b68f42d0af" + "sha256:14181a47091eb75b337af4c23078c9d09225cd4c48929f521f3bf16b09d02566", + "sha256:c10b33f250e5bba374fae86fb57f3adcebf1161bce7cdf92031915fd480c13bc" ], "markers": "python_version >= '3.9'", - "version": "==2.6.4" + "version": "==2.6.5" }, "idna": { "hashes": [ @@ -833,6 +833,7 @@ "sha256:245159e7ab20a71d989da00f280ca57da7641fa2cdcf71749c193cea540a74f7", "sha256:26540d4a9a4e2b096f1ff9cce51253d0504dca5a85872c7f7be23be5a53eb18d", "sha256:270934a475a0e4b6925b5f804e3809dd5f90f8613621d062848dd82f9cd62007", + "sha256:27422aa5f11fbcd9b18da48373eb67081243662f9b46e6fd07c3eb46e4535142", "sha256:2ad26b467a405c798aaa1458ba09d7e2b6e5f96b1ce0ac15d82fd9f95dc38a92", "sha256:2b3d2491d4d78b6b14f76881905c7a8a8abcf974aad4a8a0b065273a0ed7a2cb", "sha256:2ce3e21dc3437b1d960521eca599d57408a695a0d3c26797ea0f72e834c7ffe5", @@ -1008,12 +1009,11 @@ }, "sentry-sdk": { "hashes": [ - "sha256:6051562d2cfa8087bb8b4b8b79dc44690f8a054762a29c07e22588b1f619bfb5", - "sha256:aa4314f877d9cd9add5a0c9ba18e3f27f99f7de835ce36bd150e48a41c7c646f" + "sha256:608887855ccfe39032bfd03936e3a1c4f4fc99b3a4ac49ced54a4220de61c9c1", + "sha256:a16c997c0f4e3df63c0fc5e4207ccb1ab37900433e0f72fef88315d317829a26" ], "index": "pypi", - "markers": "python_version >= '3.6'", - "version": "==2.8.0" + "version": "==1.45.1" }, "setuptools": { "hashes": [ @@ -1120,11 +1120,11 @@ }, "virtualenv": { "hashes": [ - "sha256:23eae1b4516ecd610481eda647f3a7c09aea295055337331bb4e6892ecce47b0", - "sha256:2c9c3262bb8e7b87ea801d715fae4495e6032450c71d2309be9550e7364049aa" + "sha256:412773c85d4dab0409b83ec36f7a6499e72eaf08c80e81e9576bca61831c71cb", + "sha256:5d34ab240fdb5d21549b76f9e8ff3af28252f5499fb6d6f031adac4e5a8c5329" ], "markers": "python_version >= '3.8'", - "version": "==20.28.0" + "version": "==20.28.1" }, "wcwidth": { "hashes": [ @@ -1511,19 +1511,19 @@ }, "gitdb": { "hashes": [ - "sha256:81a3407ddd2ee8df444cbacea00e2d038e40150acfa3001696fe0dcf1d3adfa4", - "sha256:bf5421126136d6d0af55bc1e7c1af1c397a34f5b7bd79e776cd3e89785c2b04b" + "sha256:5ef71f855d191a3326fcfbc0d5da835f26b13fbcba60c32c21091c349ffdb571", + "sha256:67073e15955400952c6565cc3e707c554a4eea2e428946f7a4c162fab9bd9bcf" ], "markers": "python_version >= '3.7'", - "version": "==4.0.11" + "version": "==4.0.12" }, "gitpython": { "hashes": [ - "sha256:35f314a9f878467f5453cc1fee295c3e18e52f1b99f10f6cf5b1682e968a9e7c", - "sha256:eec7ec56b92aad751f9912a73404bc02ba212a23adb2c7098ee668417051a1ff" + "sha256:9e0e10cda9bed1ee64bc9a6de50e7e38a9c9943241cd7f585f6df3ed28011110", + "sha256:c87e30b26253bf5418b01b0660f818967f3c503193838337fe5e573331249269" ], "markers": "python_version >= '3.7'", - "version": "==3.1.43" + "version": "==3.1.44" }, "idna": { "hashes": [ @@ -1751,11 +1751,11 @@ }, "pygments": { "hashes": [ - "sha256:786ff802f32e91311bff3889f6e9a86e81505fe99f2735bb6d60ae0c5004f199", - "sha256:b8e6aca0523f3ab76fee51799c488e38782ac06eafcf95e7ba832985c8e7b13a" + "sha256:4755e6e64d22161d5b61432c0600c923c5927214e7c956e31c23923c89251a9b", + "sha256:afc4146269910d4bdfabcd27c24923137a74d562a23a320a41a55ad303e19783" ], "markers": "python_version >= '3.8'", - "version": "==2.18.0" + "version": "==2.19.0" }, "pylint": { "hashes": [ @@ -1948,11 +1948,11 @@ }, "smmap": { "hashes": [ - "sha256:dceeb6c0028fdb6734471eb07c0cd2aae706ccaecab45965ee83f11c8d3b1f62", - "sha256:e6d8668fa5f93e706934a62d7b4db19c8d9eb8cf2adbb75ef1b675aa332b69da" + "sha256:26ea65a03958fa0c8a1c7e8c7a58fdc77221b8910f6be2131affade476898ad5", + "sha256:b30115f0def7d7531d22a0fb6502488d879e75b260a9db4d0819cfb25403af5e" ], "markers": "python_version >= '3.7'", - "version": "==5.0.1" + "version": "==5.0.2" }, "snowballstemmer": { "hashes": [ diff --git a/docker-compose.yml b/docker-compose.yml index 119f0496..9395ce1e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -121,7 +121,5 @@ services: container_name: hmrc-redis expose: - 6379 - ports: - - 6379:6379 volumes: maildata: diff --git a/mail/libraries/helpers.py b/mail/libraries/helpers.py index f7e4258f..c6e778e5 100644 --- a/mail/libraries/helpers.py +++ b/mail/libraries/helpers.py @@ -338,7 +338,7 @@ def sort_dtos_by_date(input_dtos): def log_to_sentry(message, extra=None, level="info"): extra = extra or {} - with sentry_sdk.new_scope() as scope: + with sentry_sdk.push_scope() as scope: for key, value in extra.items(): scope.set_extra(key, value) sentry_sdk.capture_message(message, level=level) diff --git a/mail/tests/libraries/test_helpers.py b/mail/tests/libraries/test_helpers.py index 17c12e20..1efe24b6 100644 --- a/mail/tests/libraries/test_helpers.py +++ b/mail/tests/libraries/test_helpers.py @@ -6,10 +6,7 @@ class TestLogToSentry(unittest.TestCase): - @mock.patch("sentry_sdk.scope.Scope.capture_event") - def test_log_to_sentry(self, mock_capture_event): + @mock.patch("sentry_sdk.capture_message") + def test_log_to_sentry(self, mock_capture_message): log_to_sentry("some message", {"extra": "context"}, level="debug") - mock_capture_event.assert_called_with( - {"message": "some message", "level": "debug"}, - scope=None, - ) + mock_capture_message.assert_called_with("some message", level="debug")