From 549ce0443b02a7a4b1686b71266f0ba5bfeb71ba Mon Sep 17 00:00:00 2001 From: Kelvin Jayanoris Date: Sun, 10 Feb 2019 17:48:31 +0300 Subject: [PATCH 01/11] Upgrade packages --- Pipfile | 2 +- Pipfile.lock | 343 ++++++++++++++++++++++++++------------------------- 2 files changed, 176 insertions(+), 169 deletions(-) diff --git a/Pipfile b/Pipfile index 3b416dd..4837c4f 100644 --- a/Pipfile +++ b/Pipfile @@ -18,6 +18,6 @@ yapf = "*" ipdb = "*" model-mommy = "*" tblib = "*" -pylint-django = {git = "https://github.com/PyCQA/pylint-django.git", ref = "4316c3d90f4ac6cbbeddfc8d431f5d4e031d5cf1"} +pylint-django = "*" isort = "*" "pep8" = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 405cc1d..6e361d2 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "fa82db7dfb5cba0e2d4551a00fa582c08447804fa5dec44e34ff633b8a541dce" + "sha256": "0354173d6ee77bd122a85597b73a7c45cf3406de5c599cd048a182ad7fdefc41" }, "pipfile-spec": 6, "requires": { @@ -25,10 +25,10 @@ }, "django": { "hashes": [ - "sha256:1ffab268ada3d5684c05ba7ce776eaeedef360712358d6a6b340ae9f16486916", - "sha256:dd46d87af4c1bf54f4c926c3cfa41dc2b5c15782f15e4329752ce65f5dad1c37" + "sha256:a32c22af23634e1d11425574dce756098e015a165be02e4690179889b207c7a8", + "sha256:d6393918da830530a9516bbbcbf7f1214c3d733738779f06b0f649f49cc698c3" ], - "version": "==2.1.3" + "version": "==2.1.5" }, "django-crispy-forms": { "hashes": [ @@ -39,9 +39,9 @@ }, "django-phonenumber-field": { "hashes": [ - "sha256:07f18e3a26310453c03c7e67dc9743335dc19a645fcb38e84284a50903f506c0" + "sha256:2ae79857113b500f733885b2ebacf8d6fbf21970f2416bd4a3160ec9b91ce831" ], - "version": "==2.1.0" + "version": "==2.2.0" }, "django-private-storage": { "hashes": [ @@ -52,11 +52,10 @@ }, "djangorestframework": { "hashes": [ - "sha256:607865b0bb1598b153793892101d881466bd5a991de12bd6229abb18b1c86136", - "sha256:63f76cbe1e7d12b94c357d7e54401103b2e52aef0f7c1650d6c820ad708776e5" + "sha256:79c6efbb2514bc50cf25906d7c0a5cfead714c7af667ff4bd110312cd380ae66", + "sha256:a4138613b67e3a223be6c97f53b13d759c5b90d2b433bad670b8ebf95402075f" ], - "markers": "python_version != '3.1.*' and python_version != '3.2.*' and python_version != '3.0.*' and python_version >= '2.7' and python_version != '3.3.*'", - "version": "==3.9.0" + "version": "==3.9.1" }, "e1839a8": { "editable": true, @@ -64,88 +63,87 @@ }, "phonenumberslite": { "hashes": [ - "sha256:2db0b001d9103488fc7a2c844c5b2b565557652e1b75607315652063769a2aea", - "sha256:fa01b5ef3581dcc66ba8fcb91b3d3e4e2a82b0b232d71e24b8e345915b0b3318" + "sha256:00492aef17a5665fed4a39362fae49a1b2e9226d8ada20ce95c44d97ef778883", + "sha256:06ce1d49d1e16bec070a46f103062583b997fac178d59631f0d60c02967eb5f6" ], - "version": "==8.9.16" + "version": "==8.10.5" }, "pillow": { "hashes": [ - "sha256:00203f406818c3f45d47bb8fe7e67d3feddb8dcbbd45a289a1de7dd789226360", - "sha256:0616f800f348664e694dddb0b0c88d26761dd5e9f34e1ed7b7a7d2da14b40cb7", - "sha256:1f7908aab90c92ad85af9d2fec5fc79456a89b3adcc26314d2cde0e238bd789e", - "sha256:2ea3517cd5779843de8a759c2349a3cd8d3893e03ab47053b66d5ec6f8bc4f93", - "sha256:48a9f0538c91fc136b3a576bee0e7cd174773dc9920b310c21dcb5519722e82c", - "sha256:5280ebc42641a1283b7b1f2c20e5b936692198b9dd9995527c18b794850be1a8", - "sha256:5e34e4b5764af65551647f5cc67cf5198c1d05621781d5173b342e5e55bf023b", - "sha256:63b120421ab85cad909792583f83b6ca3584610c2fe70751e23f606a3c2e87f0", - "sha256:696b5e0109fe368d0057f484e2e91717b49a03f1e310f857f133a4acec9f91dd", - "sha256:870ed021a42b1b02b5fe4a739ea735f671a84128c0a666c705db2cb9abd528eb", - "sha256:916da1c19e4012d06a372127d7140dae894806fad67ef44330e5600d77833581", - "sha256:9303a289fa0811e1c6abd9ddebfc770556d7c3311cb2b32eff72164ddc49bc64", - "sha256:9577888ecc0ad7d06c3746afaba339c94d62b59da16f7a5d1cff9e491f23dace", - "sha256:987e1c94a33c93d9b209315bfda9faa54b8edfce6438a1e93ae866ba20de5956", - "sha256:99a3bbdbb844f4fb5d6dd59fac836a40749781c1fa63c563bc216c27aef63f60", - "sha256:99db8dc3097ceafbcff9cb2bff384b974795edeb11d167d391a02c7bfeeb6e16", - "sha256:a5a96cf49eb580756a44ecf12949e52f211e20bffbf5a95760ac14b1e499cd37", - "sha256:aa6ca3eb56704cdc0d876fc6047ffd5ee960caad52452fbee0f99908a141a0ae", - "sha256:aade5e66795c94e4a2b2624affeea8979648d1b0ae3fcee17e74e2c647fc4a8a", - "sha256:b78905860336c1d292409e3df6ad39cc1f1c7f0964e66844bbc2ebfca434d073", - "sha256:b92f521cdc4e4a3041cc343625b699f20b0b5f976793fb45681aac1efda565f8", - "sha256:bfde84bbd6ae5f782206d454b67b7ee8f7f818c29b99fd02bf022fd33bab14cb", - "sha256:c2b62d3df80e694c0e4a0ed47754c9480521e25642251b3ab1dff050a4e60409", - "sha256:c5e2be6c263b64f6f7656e23e18a4a9980cffc671442795682e8c4e4f815dd9f", - "sha256:c99aa3c63104e0818ec566f8ff3942fb7c7a8f35f9912cb63fd8e12318b214b2", - "sha256:dae06620d3978da346375ebf88b9e2dd7d151335ba668c995aea9ed07af7add4", - "sha256:db5499d0710823fa4fb88206050d46544e8f0e0136a9a5f5570b026584c8fd74", - "sha256:f36baafd82119c4a114b9518202f2a983819101dcc14b26e43fc12cbefdce00e", - "sha256:f52b79c8796d81391ab295b04e520bda6feed54d54931708872e8f9ae9db0ea1", - "sha256:ff8cff01582fa1a7e533cb97f628531c4014af4b5f38e33cdcfe5eec29b6d888" - ], - "markers": "python_version != '3.0.*' and python_version != '3.3.*' and python_version != '3.2.*' and python_version != '3.1.*' and python_version >= '2.7'", - "version": "==5.3.0" + "sha256:051de330a06c99d6f84bcf582960487835bcae3fc99365185dc2d4f65a390c0e", + "sha256:0ae5289948c5e0a16574750021bd8be921c27d4e3527800dc9c2c1d2abc81bf7", + "sha256:0b1efce03619cdbf8bcc61cfae81fcda59249a469f31c6735ea59badd4a6f58a", + "sha256:163136e09bd1d6c6c6026b0a662976e86c58b932b964f255ff384ecc8c3cefa3", + "sha256:18e912a6ccddf28defa196bd2021fe33600cbe5da1aa2f2e2c6df15f720b73d1", + "sha256:24ec3dea52339a610d34401d2d53d0fb3c7fd08e34b20c95d2ad3973193591f1", + "sha256:267f8e4c0a1d7e36e97c6a604f5b03ef58e2b81c1becb4fccecddcb37e063cc7", + "sha256:3273a28734175feebbe4d0a4cde04d4ed20f620b9b506d26f44379d3c72304e1", + "sha256:4c678e23006798fc8b6f4cef2eaad267d53ff4c1779bd1af8725cc11b72a63f3", + "sha256:4d4bc2e6bb6861103ea4655d6b6f67af8e5336e7216e20fff3e18ffa95d7a055", + "sha256:505738076350a337c1740a31646e1de09a164c62c07db3b996abdc0f9d2e50cf", + "sha256:5233664eadfa342c639b9b9977190d64ad7aca4edc51a966394d7e08e7f38a9f", + "sha256:5d95cb9f6cced2628f3e4de7e795e98b2659dfcc7176ab4a01a8b48c2c2f488f", + "sha256:7eda4c737637af74bac4b23aa82ea6fbb19002552be85f0b89bc27e3a762d239", + "sha256:801ddaa69659b36abf4694fed5aa9f61d1ecf2daaa6c92541bbbbb775d97b9fe", + "sha256:825aa6d222ce2c2b90d34a0ea31914e141a85edefc07e17342f1d2fdf121c07c", + "sha256:9c215442ff8249d41ff58700e91ef61d74f47dfd431a50253e1a1ca9436b0697", + "sha256:a3d90022f2202bbb14da991f26ca7a30b7e4c62bf0f8bf9825603b22d7e87494", + "sha256:a631fd36a9823638fe700d9225f9698fb59d049c942d322d4c09544dc2115356", + "sha256:a6523a23a205be0fe664b6b8747a5c86d55da960d9586db039eec9f5c269c0e6", + "sha256:a756ecf9f4b9b3ed49a680a649af45a8767ad038de39e6c030919c2f443eb000", + "sha256:b117287a5bdc81f1bac891187275ec7e829e961b8032c9e5ff38b70fd036c78f", + "sha256:ba04f57d1715ca5ff74bb7f8a818bf929a204b3b3c2c2826d1e1cc3b1c13398c", + "sha256:cd878195166723f30865e05d87cbaf9421614501a4bd48792c5ed28f90fd36ca", + "sha256:cee815cc62d136e96cf76771b9d3eb58e0777ec18ea50de5cfcede8a7c429aa8", + "sha256:d1722b7aa4b40cf93ac3c80d3edd48bf93b9208241d166a14ad8e7a20ee1d4f3", + "sha256:d7c1c06246b05529f9984435fc4fa5a545ea26606e7f450bdbe00c153f5aeaad", + "sha256:e9c8066249c040efdda84793a2a669076f92a301ceabe69202446abb4c5c5ef9", + "sha256:f227d7e574d050ff3996049e086e1f18c7bd2d067ef24131e50a1d3fe5831fbc", + "sha256:fc9a12aad714af36cf3ad0275a96a733526571e52710319855628f476dcb144e" + ], + "version": "==5.4.1" }, "psycopg2-binary": { "hashes": [ - "sha256:036bcb198a7cc4ce0fe43344f8c2c9a8155aefa411633f426c8c6ed58a6c0426", - "sha256:1d770fcc02cdf628aebac7404d56b28a7e9ebec8cfc0e63260bd54d6edfa16d4", - "sha256:1fdc6f369dcf229de6c873522d54336af598b9470ccd5300e2f58ee506f5ca13", - "sha256:21f9ddc0ff6e07f7d7b6b484eb9da2c03bc9931dd13e36796b111d631f7135a3", - "sha256:247873cda726f7956f745a3e03158b00de79c4abea8776dc2f611d5ba368d72d", - "sha256:3aa31c42f29f1da6f4fd41433ad15052d5ff045f2214002e027a321f79d64e2c", - "sha256:475f694f87dbc619010b26de7d0fc575a4accf503f2200885cc21f526bffe2ad", - "sha256:4b5e332a24bf6e2fda1f51ca2a57ae1083352293a08eeea1fa1112dc7dd542d1", - "sha256:570d521660574aca40be7b4d532dfb6f156aad7b16b5ed62d1534f64f1ef72d8", - "sha256:59072de7def0690dd13112d2bdb453e20570a97297070f876fbbb7cbc1c26b05", - "sha256:5f0b658989e918ef187f8a08db0420528126f2c7da182a7b9f8bf7f85144d4e4", - "sha256:649199c84a966917d86cdc2046e03d536763576c0b2a756059ae0b3a9656bc20", - "sha256:6645fc9b4705ae8fbf1ef7674f416f89ae1559deec810f6dd15197dfa52893da", - "sha256:6872dd54d4e398d781efe8fe2e2d7eafe4450d61b5c4898aced7610109a6df75", - "sha256:6ce34fbc251fc0d691c8d131250ba6f42fd2b28ef28558d528ba8c558cb28804", - "sha256:73920d167a0a4d1006f5f3b9a3efce6f0e5e883a99599d38206d43f27697df00", - "sha256:8a671732b87ae423e34b51139628123bc0306c2cb85c226e71b28d3d57d7e42a", - "sha256:8d517e8fda2efebca27c2018e14c90ed7dc3f04d7098b3da2912e62a1a5585fe", - "sha256:9475a008eb7279e20d400c76471843c321b46acacc7ee3de0b47233a1e3fa2cf", - "sha256:96947b8cd7b3148fb0e6549fcb31258a736595d6f2a599f8cd450e9a80a14781", - "sha256:abf229f24daa93f67ac53e2e17c8798a71a01711eb9fcdd029abba8637164338", - "sha256:b1ab012f276df584beb74f81acb63905762c25803ece647016613c3d6ad4e432", - "sha256:b22b33f6f0071fe57cb4e9158f353c88d41e739a3ec0d76f7b704539e7076427", - "sha256:b3b2d53274858e50ad2ffdd6d97ce1d014e1e530f82ec8b307edd5d4c921badf", - "sha256:bab26a729befc7b9fab9ded1bba9c51b785188b79f8a2796ba03e7e734269e2e", - "sha256:daa1a593629aa49f506eddc9d23dc7f89b35693b90e1fbcd4480182d1203ea90", - "sha256:dd111280ce40e89fd17b19c1269fd1b74a30fce9d44a550840e86edb33924eb8", - "sha256:e0b86084f1e2e78c451994410de756deba206884d6bed68d5a3d7f39ff5fea1d", - "sha256:eb86520753560a7e89639500e2a254bb6f683342af598088cb72c73edcad21e6", - "sha256:ff18c5c40a38d41811c23e2480615425c97ea81fd7e9118b8b899c512d97c737" - ], - "version": "==2.7.6.1" + "sha256:19a2d1f3567b30f6c2bb3baea23f74f69d51f0c06c2e2082d0d9c28b0733a4c2", + "sha256:2b69cf4b0fa2716fd977aa4e1fd39af6110eb47b2bb30b4e5a469d8fbecfc102", + "sha256:2e952fa17ba48cbc2dc063ddeec37d7dc4ea0ef7db0ac1eda8906365a8543f31", + "sha256:348b49dd737ff74cfb5e663e18cb069b44c64f77ec0523b5794efafbfa7df0b8", + "sha256:3d72a5fdc5f00ca85160915eb9a973cf9a0ab8148f6eda40708bf672c55ac1d1", + "sha256:4957452f7868f43f32c090dadb4188e9c74a4687323c87a882e943c2bd4780c3", + "sha256:5138cec2ee1e53a671e11cc519505eb08aaaaf390c508f25b09605763d48de4b", + "sha256:587098ca4fc46c95736459d171102336af12f0d415b3b865972a79c03f06259f", + "sha256:5b79368bcdb1da4a05f931b62760bea0955ee2c81531d8e84625df2defd3f709", + "sha256:5cf43807392247d9bc99737160da32d3fa619e0bfd85ba24d1c78db205f472a4", + "sha256:676d1a80b1eebc0cacae8dd09b2fde24213173bf65650d22b038c5ed4039f392", + "sha256:6b0211ecda389101a7d1d3df2eba0cf7ffbdd2480ca6f1d2257c7bd739e84110", + "sha256:79cde4660de6f0bb523c229763bd8ad9a93ac6760b72c369cf1213955c430934", + "sha256:7aba9786ac32c2a6d5fb446002ed936b47d5e1f10c466ef7e48f66eb9f9ebe3b", + "sha256:7c8159352244e11bdd422226aa17651110b600d175220c451a9acf795e7414e0", + "sha256:945f2eedf4fc6b2432697eb90bb98cc467de5147869e57405bfc31fa0b824741", + "sha256:96b4e902cde37a7fc6ab306b3ac089a3949e6ce3d824eeca5b19dc0bedb9f6e2", + "sha256:9a7bccb1212e63f309eb9fab47b6eaef796f59850f169a25695b248ca1bf681b", + "sha256:a3bfcac727538ec11af304b5eccadbac952d4cca1a551a29b8fe554e3ad535dc", + "sha256:b19e9f1b85c5d6136f5a0549abdc55dcbd63aba18b4f10d0d063eb65ef2c68b4", + "sha256:b664011bb14ca1f2287c17185e222f2098f7b4c857961dbcf9badb28786dbbf4", + "sha256:bde7959ef012b628868d69c474ec4920252656d0800835ed999ba5e4f57e3e2e", + "sha256:cb095a0657d792c8de9f7c9a0452385a309dfb1bbbb3357d6b1e216353ade6ca", + "sha256:d16d42a1b9772152c1fe606f679b2316551f7e1a1ce273e7f808e82a136cdb3d", + "sha256:d444b1545430ffc1e7a24ce5a9be122ccd3b135a7b7e695c5862c5aff0b11159", + "sha256:d93ccc7bf409ec0a23f2ac70977507e0b8a8d8c54e5ee46109af2f0ec9e411f3", + "sha256:df6444f952ca849016902662e1a47abf4fa0678d75f92fd9dd27f20525f809cd", + "sha256:e63850d8c52ba2b502662bf3c02603175c2397a9acc756090e444ce49508d41e", + "sha256:ec43358c105794bc2b6fd34c68d27f92bea7102393c01889e93f4b6a70975728", + "sha256:f4c6926d9c03dadce7a3b378b40d2fea912c1344ef9b29869f984fb3d2a2420b" + ], + "version": "==2.7.7" }, "pytz": { "hashes": [ - "sha256:31cb35c89bd7d333cd32c5f278fca91b523b0834369e757f4c5641ea252236ca", - "sha256:8e0f8568c118d3077b46be7d654cc8167fa916092e28320cde048e54bfc9f1e6" + "sha256:32b0891edff07e28efe91284ed9c31e123d84bea3fd98e1f72be2508f43ef8d9", + "sha256:d5f05e487007e29e03409f9398d074e158d920d36eb82eaf66fb1136b0c5374c" ], - "version": "==2018.7" + "version": "==2018.9" }, "sorl-thumbnail": { "hashes": [ @@ -165,10 +163,10 @@ "develop": { "astroid": { "hashes": [ - "sha256:292fa429e69d60e4161e7612cb7cc8fa3609e2e309f80c224d93a76d5e7b58be", - "sha256:c7013d119ec95eb626f7a2011f0b63d0c9a095df9ad06d8507b37084eada1a8d" + "sha256:35b032003d6a863f5dcd7ec11abd5cd5893428beaa31ab164982403bcb311f22", + "sha256:6a5d668d7dc69110de01cdf7aeec69a679ef486862a0850cc0fd5571505b6b7e" ], - "version": "==2.0.4" + "version": "==2.1.0" }, "backcall": { "hashes": [ @@ -216,17 +214,24 @@ }, "decorator": { "hashes": [ - "sha256:2c51dff8ef3c447388fe5e4453d24a2bf128d3a4c32af3fabef1f01c6851ab82", - "sha256:c39efa13fbdeb4506c476c9b3babf6a718da943dab7811c206005a4a956c080c" + "sha256:33cd704aea07b4c28b3eb2c97d288a06918275dac0ecebdaf1bc8a48d98adb9e", + "sha256:cabb249f4710888a2fc0e13e9a16c343d932033718ff62e1e9bc93a9d3a9122b" ], - "version": "==4.3.0" + "version": "==4.3.2" }, "django": { "hashes": [ - "sha256:1ffab268ada3d5684c05ba7ce776eaeedef360712358d6a6b340ae9f16486916", - "sha256:dd46d87af4c1bf54f4c926c3cfa41dc2b5c15782f15e4329752ce65f5dad1c37" + "sha256:a32c22af23634e1d11425574dce756098e015a165be02e4690179889b207c7a8", + "sha256:d6393918da830530a9516bbbcbf7f1214c3d733738779f06b0f649f49cc698c3" ], - "version": "==2.1.3" + "version": "==2.1.5" + }, + "entrypoints": { + "hashes": [ + "sha256:589f874b313739ad35be6e0cd7efde2a4e9b6fea91edcc34e58ecbb8dbe56d19", + "sha256:c70dd71abe5a8c85e55e12c19bd91ccfeec11a6e99044204511f9ed547d48451" + ], + "version": "==0.3" }, "filelock": { "hashes": [ @@ -237,11 +242,11 @@ }, "flake8": { "hashes": [ - "sha256:6a35f5b8761f45c5513e3405f110a86bea57982c3b75b766ce7b65217abe1670", - "sha256:c01f8a3963b3571a8e6bd7a4063359aff90749e160778e03817cd9b71c9e07d2" + "sha256:c3ba1e130c813191db95c431a18cb4d20a468e98af7a77e2181b68574481ad36", + "sha256:fd9ddf503110bf3d8b1d270e8c673aab29ccb3dd6abf29bae1f54e5116ab4a91" ], "index": "pypi", - "version": "==3.6.0" + "version": "==3.7.5" }, "ipdb": { "hashes": [ @@ -252,10 +257,10 @@ }, "ipython": { "hashes": [ - "sha256:a5781d6934a3341a1f9acb4ea5acdc7ea0a0855e689dbe755d070ca51e995435", - "sha256:b10a7ddd03657c761fc503495bc36471c8158e3fc948573fb9fe82a7029d8efd" + "sha256:6a9496209b76463f1dec126ab928919aaf1f55b38beb9219af3fe202f6bbdd12", + "sha256:f69932b1e806b38a7818d9a1e918e5821b685715040b48e59c657b3c7961b742" ], - "version": "==7.1.1" + "version": "==7.2.0" }, "ipython-genutils": { "hashes": [ @@ -275,10 +280,10 @@ }, "jedi": { "hashes": [ - "sha256:0191c447165f798e6a730285f2eee783fff81b0d3df261945ecb80983b5c3ca7", - "sha256:b7493f73a2febe0dc33d51c99b474547f7f6c0b2c8fb2b21f453eef204c12148" + "sha256:571702b5bd167911fe9036e5039ba67f820d6502832285cde8c881ab2b2149fd", + "sha256:c8481b5e59d34a5c7c42e98f6625e633f6ef59353abea6437472c7ec2093f191" ], - "version": "==0.13.1" + "version": "==0.13.2" }, "lazy-object-proxy": { "hashes": [ @@ -331,10 +336,10 @@ }, "parso": { "hashes": [ - "sha256:35704a43a3c113cce4de228ddb39aab374b8004f4f2407d070b6a2ca784ce8a2", - "sha256:895c63e93b94ac1e1690f5fdd40b65f07c8171e3e53cbd7793b5b96c0e0a7f24" + "sha256:6ecf7244be8e7283ec9009c72d074830e7e0e611c974f813d76db0390a4e0dd6", + "sha256:8162be7570ffb34ec0b8d215d7f3b6c5fab24f51eb3886d6dee362de96b6db94" ], - "version": "==0.3.1" + "version": "==0.3.3" }, "pep8": { "hashes": [ @@ -361,19 +366,18 @@ }, "pluggy": { "hashes": [ - "sha256:447ba94990e8014ee25ec853339faf7b0fc8050cdc3289d4d71f7f410fb90095", - "sha256:bde19360a8ec4dfd8a20dcb811780a30998101f078fc7ded6162f0076f50508f" + "sha256:8ddc32f03971bfdf900a81961a48ccf2fb677cf7715108f85295c67405798616", + "sha256:980710797ff6a041e9a73a5787804f848996ecaa6f8a1b1e08224a5894f2074a" ], - "markers": "python_version >= '2.7' and python_version != '3.3.*' and python_version != '3.0.*' and python_version != '3.2.*' and python_version != '3.1.*'", - "version": "==0.8.0" + "version": "==0.8.1" }, "prompt-toolkit": { "hashes": [ - "sha256:c1d6aff5252ab2ef391c2fe498ed8c088066f66bc64a8d5c095bbf795d9fec34", - "sha256:d4c47f79b635a0e70b84fdb97ebd9a274203706b1ee5ed44c10da62755cf3ec9", - "sha256:fd17048d8335c1e6d5ee403c3569953ba3eb8555d710bfc548faf0712666ea39" + "sha256:88002cc618cacfda8760c4539e76c3b3f148ecdb7035a3d422c7ecdc90c2a3ba", + "sha256:c6655a12e9b08edb8cf5aeab4815fd1e1bdea4ad73d3bbf269cf2e0c4eb75d5e", + "sha256:df5835fb8f417aa55e5cafadbaeb0cf630a1e824aad16989f9f0493e679ec010" ], - "version": "==2.0.7" + "version": "==2.0.8" }, "ptyprocess": { "hashes": [ @@ -387,56 +391,64 @@ "sha256:bf92637198836372b520efcba9e020c330123be8ce527e535d185ed4b6f45694", "sha256:e76826342cefe3c3d5f7e8ee4316b80d1dd8a300781612ddbc765c17ba25a6c6" ], - "markers": "python_version >= '2.7' and python_version != '3.3.*' and python_version != '3.0.*' and python_version != '3.2.*' and python_version != '3.1.*'", "version": "==1.7.0" }, "pycodestyle": { "hashes": [ - "sha256:cbc619d09254895b0d12c2c691e237b2e91e9b2ecf5e84c26b35400f93dcfb83", - "sha256:cbfca99bd594a10f674d0cd97a3d802a1fdef635d4361e1a2658de47ed261e3a" + "sha256:95a2219d12372f05704562a14ec30bc76b05a5b297b21a5dfe3f6fac3491ae56", + "sha256:e40a936c9a450ad81df37f549d676d127b1b66000a6c500caa2b085bc0ca976c" ], - "version": "==2.4.0" + "version": "==2.5.0" }, "pyflakes": { "hashes": [ - "sha256:9a7662ec724d0120012f6e29d6248ae3727d821bba522a0e6b356eff19126a49", - "sha256:f661252913bc1dbe7fcfcbf0af0db3f42ab65aabd1a6ca68fe5d466bace94dae" + "sha256:5e8c00e30c464c99e0b501dc160b13a14af7f27d4dffb529c556e30a159e231d", + "sha256:f277f9ca3e55de669fba45b7393a1449009cff5a37d1af10ebb76c52765269cd" ], - "markers": "python_version != '3.0.*' and python_version != '3.1.*' and python_version >= '2.7' and python_version != '3.2.*' and python_version != '3.3.*'", - "version": "==2.0.0" + "version": "==2.1.0" }, "pygments": { "hashes": [ - "sha256:78f3f434bcc5d6ee09020f92ba487f95ba50f1e3ef83ae96b9d5ffa1bab25c5d", - "sha256:dbae1046def0efb574852fab9e90209b23f556367b5a320c0bcb871c77c3e8cc" + "sha256:5ffada19f6203563680669ee7f53b64dabbeb100eb51b61996085e99c03b284a", + "sha256:e8218dd399a61674745138520d0d4cf2621d7e032439341bc3f647bff125818d" ], - "version": "==2.2.0" + "version": "==2.3.1" }, "pylint": { "hashes": [ - "sha256:1d6d3622c94b4887115fe5204982eee66fdd8a951cf98635ee5caee6ec98c3ec", - "sha256:31142f764d2a7cd41df5196f9933b12b7ee55e73ef12204b648ad7e556c119fb" + "sha256:689de29ae747642ab230c6d37be2b969bf75663176658851f456619aacf27492", + "sha256:771467c434d0d9f081741fec1d64dfb011ed26e65e12a28fe06ca2f61c4d556c" ], "index": "pypi", - "version": "==2.1.1" + "version": "==2.2.2" }, "pylint-django": { - "git": "https://github.com/PyCQA/pylint-django.git", - "ref": "4316c3d90f4ac6cbbeddfc8d431f5d4e031d5cf1" + "hashes": [ + "sha256:23d673c940710081d1e7417886cd14b0eca39ca9d9e50373961903cf2a607ccd", + "sha256:ea3ae50a42904feecceb408d173dec00098938f3e5690d2c0fda2dda5dde5825" + ], + "index": "pypi", + "version": "==2.0.5" + }, + "pylint-plugin-utils": { + "hashes": [ + "sha256:8ad25a82bcce390d1d6b7c006c123e0cb18051839c9df7b8bdb7823c53fe676e" + ], + "version": "==0.4" }, "pytz": { "hashes": [ - "sha256:31cb35c89bd7d333cd32c5f278fca91b523b0834369e757f4c5641ea252236ca", - "sha256:8e0f8568c118d3077b46be7d654cc8167fa916092e28320cde048e54bfc9f1e6" + "sha256:32b0891edff07e28efe91284ed9c31e123d84bea3fd98e1f72be2508f43ef8d9", + "sha256:d5f05e487007e29e03409f9398d074e158d920d36eb82eaf66fb1136b0c5374c" ], - "version": "==2018.7" + "version": "==2018.9" }, "six": { "hashes": [ - "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", - "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb" + "sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c", + "sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73" ], - "version": "==1.11.0" + "version": "==1.12.0" }, "tblib": { "hashes": [ @@ -455,11 +467,11 @@ }, "tox": { "hashes": [ - "sha256:513e32fdf2f9e2d583c2f248f47ba9886428c949f068ac54a0469cac55df5862", - "sha256:75fa30e8329b41b664585f5fb837e23ce1d7e6fa1f7811f2be571c990f9d911b" + "sha256:04f8f1aa05de8e76d7a266ccd14e0d665d429977cd42123bc38efa9b59964e9e", + "sha256:25ef928babe88c71e3ed3af0c464d1160b01fca2dd1870a5bb26c2dea61a17fc" ], "index": "pypi", - "version": "==3.5.3" + "version": "==3.7.0" }, "traitlets": { "hashes": [ @@ -470,40 +482,35 @@ }, "typed-ast": { "hashes": [ - "sha256:0948004fa228ae071054f5208840a1e88747a357ec1101c17217bfe99b299d58", - "sha256:10703d3cec8dcd9eef5a630a04056bbc898abc19bac5691612acba7d1325b66d", - "sha256:1f6c4bd0bdc0f14246fd41262df7dfc018d65bb05f6e16390b7ea26ca454a291", - "sha256:25d8feefe27eb0303b73545416b13d108c6067b846b543738a25ff304824ed9a", - "sha256:29464a177d56e4e055b5f7b629935af7f49c196be47528cc94e0a7bf83fbc2b9", - "sha256:2e214b72168ea0275efd6c884b114ab42e316de3ffa125b267e732ed2abda892", - "sha256:3e0d5e48e3a23e9a4d1a9f698e32a542a4a288c871d33ed8df1b092a40f3a0f9", - "sha256:519425deca5c2b2bdac49f77b2c5625781abbaf9a809d727d3a5596b30bb4ded", - "sha256:57fe287f0cdd9ceaf69e7b71a2e94a24b5d268b35df251a88fef5cc241bf73aa", - "sha256:668d0cec391d9aed1c6a388b0d5b97cd22e6073eaa5fbaa6d2946603b4871efe", - "sha256:68ba70684990f59497680ff90d18e756a47bf4863c604098f10de9716b2c0bdd", - "sha256:6de012d2b166fe7a4cdf505eee3aaa12192f7ba365beeefaca4ec10e31241a85", - "sha256:79b91ebe5a28d349b6d0d323023350133e927b4de5b651a8aa2db69c761420c6", - "sha256:8550177fa5d4c1f09b5e5f524411c44633c80ec69b24e0e98906dd761941ca46", - "sha256:898f818399cafcdb93cbbe15fc83a33d05f18e29fb498ddc09b0214cdfc7cd51", - "sha256:94b091dc0f19291adcb279a108f5d38de2430411068b219f41b343c03b28fb1f", - "sha256:a26863198902cda15ab4503991e8cf1ca874219e0118cbf07c126bce7c4db129", - "sha256:a8034021801bc0440f2e027c354b4eafd95891b573e12ff0418dec385c76785c", - "sha256:bc978ac17468fe868ee589c795d06777f75496b1ed576d308002c8a5756fb9ea", - "sha256:c05b41bc1deade9f90ddc5d988fe506208019ebba9f2578c622516fd201f5863", - "sha256:c9b060bd1e5a26ab6e8267fd46fc9e02b54eb15fffb16d112d4c7b1c12987559", - "sha256:edb04bdd45bfd76c8292c4d9654568efaedf76fe78eb246dde69bdb13b2dad87", - "sha256:f19f2a4f547505fe9072e15f6f4ae714af51b5a681a97f187971f50c283193b6" + "sha256:035a54ede6ce1380599b2ce57844c6554666522e376bd111eb940fbc7c3dad23", + "sha256:037c35f2741ce3a9ac0d55abfcd119133cbd821fffa4461397718287092d9d15", + "sha256:049feae7e9f180b64efacbdc36b3af64a00393a47be22fa9cb6794e68d4e73d3", + "sha256:19228f7940beafc1ba21a6e8e070e0b0bfd1457902a3a81709762b8b9039b88d", + "sha256:2ea681e91e3550a30c2265d2916f40a5f5d89b59469a20f3bad7d07adee0f7a6", + "sha256:3a6b0a78af298d82323660df5497bcea0f0a4a25a0b003afd0ce5af049bd1f60", + "sha256:5385da8f3b801014504df0852bf83524599df890387a3c2b17b7caa3d78b1773", + "sha256:606d8afa07eef77280c2bf84335e24390055b478392e1975f96286d99d0cb424", + "sha256:69245b5b23bbf7fb242c9f8f08493e9ecd7711f063259aefffaeb90595d62287", + "sha256:6f6d839ab09830d59b7fa8fb6917023d8cb5498ee1f1dbd82d37db78eb76bc99", + "sha256:730888475f5ac0e37c1de4bd05eeb799fdb742697867f524dc8a4cd74bcecc23", + "sha256:9819b5162ffc121b9e334923c685b0d0826154e41dfe70b2ede2ce29034c71d8", + "sha256:9e60ef9426efab601dd9aa120e4ff560f4461cf8442e9c0a2b92548d52800699", + "sha256:af5fbdde0690c7da68e841d7fc2632345d570768ea7406a9434446d7b33b0ee1", + "sha256:b64efdbdf3bbb1377562c179f167f3bf301251411eb5ac77dec6b7d32bcda463", + "sha256:bac5f444c118aeb456fac1b0b5d14c6a71ea2a42069b09c176f75e9bd4c186f6", + "sha256:bda9068aafb73859491e13b99b682bd299c1b5fd50644d697533775828a28ee0", + "sha256:d659517ca116e6750101a1326107d3479028c5191f0ecee3c7203c50f5b915b0", + "sha256:eddd3fb1f3e0f82e5915a899285a39ee34ce18fd25d89582bc89fc9fb16cd2c6" ], "markers": "python_version < '3.7' and implementation_name == 'cpython'", - "version": "==1.1.0" + "version": "==1.3.1" }, "virtualenv": { "hashes": [ - "sha256:686176c23a538ecc56d27ed9d5217abd34644823d6391cbeb232f42bf722baad", - "sha256:f899fafcd92e1150f40c8215328be38ff24b519cd95357fa6e78e006c7638208" + "sha256:8b9abfc51c38b70f61634bf265e5beacf6fae11fc25d355d1871f49b8e45f0db", + "sha256:cceab52aa7d4df1e1871a70236eb2b89fcfe29b6b43510d9738689787c513261" ], - "markers": "python_version != '3.3.*' and python_version != '3.0.*' and python_version >= '2.7' and python_version != '3.1.*' and python_version != '3.2.*'", - "version": "==16.1.0" + "version": "==16.4.0" }, "wcwidth": { "hashes": [ @@ -514,17 +521,17 @@ }, "wrapt": { "hashes": [ - "sha256:d4d560d479f2c21e1b5443bbd15fe7ec4b37fe7e53d335d3b9b0a7b1226fe3c6" + "sha256:4aea003270831cceb8a90ff27c4031da6ead7ec1886023b80ce0dfe0adf61533" ], - "version": "==1.10.11" + "version": "==1.11.1" }, "yapf": { "hashes": [ - "sha256:b96815bd0bbd2ab290f2ae9e610756940b17a0523ef2f6b2d31da749fc395137", - "sha256:cebb6faf35c9027c08996c07831b8971f3d67c0eb615269f66dfd7e6815fdc2a" + "sha256:edb47be90a56ca6f3075fe24f119a22225fbd62c66777b5d3916a7e9e793891b", + "sha256:f58069d5e0df60c078f3f986b8a63acfda73aa6ebb7cd423f6eabd1cb06420ba" ], "index": "pypi", - "version": "==0.24.0" + "version": "==0.26.0" } } } From 7cfd25a6fedf040d9902ab5b73af9c3c939239d1 Mon Sep 17 00:00:00 2001 From: Kelvin Jayanoris Date: Sun, 10 Feb 2019 17:55:35 +0300 Subject: [PATCH 02/11] Fix pylint issue --- small_small_hr/apps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/small_small_hr/apps.py b/small_small_hr/apps.py index 68ac393..d046917 100644 --- a/small_small_hr/apps.py +++ b/small_small_hr/apps.py @@ -12,7 +12,7 @@ class SmallSmallHrConfig(AppConfig): app_label = 'small_small_hr' def ready(self): - # pylint: disable=unused-variable + # pylint: disable=unused-import import small_small_hr.signals # noqa # set up app settings From ffc4d22b0a720475b919b3112972c9af0ffdf069 Mon Sep 17 00:00:00 2001 From: Kelvin Jayanoris Date: Sun, 10 Feb 2019 18:19:47 +0300 Subject: [PATCH 03/11] Document settings better --- small_small_hr/settings.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/small_small_hr/settings.py b/small_small_hr/settings.py index 3c5ed82..9ae77c7 100644 --- a/small_small_hr/settings.py +++ b/small_small_hr/settings.py @@ -28,11 +28,11 @@ SSHR_ADMIN_EMAILS = [settings.DEFAULT_FROM_EMAIL] SSHR_ADMIN_LEAVE_EMAILS = SSHR_ADMIN_EMAILS SSHR_ADMIN_OVERTIME_EMAILS = SSHR_ADMIN_EMAILS -# SSHR_LEAVE_PROCESSED_EMAIL_TXT -# SSHR_LEAVE_PROCESSED_EMAIL_SUBJ -# SSHR_LEAVE_APPLICATION_EMAIL_TXT -# SSHR_LEAVE_APPLICATION_EMAIL_SUBJ -# SSHR_OVERTIME_PROCESSED_EMAIL_TXT -# SSHR_OVERTIME_PROCESSED_EMAIL_SUBJ -# SSHR_OVERTIME_APPLICATION_EMAIL_TXT -# SSHR_OVERTIME_APPLICATION_EMAIL_SUBJ +# SSHR_LEAVE_PROCESSED_EMAIL_TXT - text of processed leave email +# SSHR_LEAVE_PROCESSED_EMAIL_SUBJ - subject of processed leave email +# SSHR_LEAVE_APPLICATION_EMAIL_TXT - text of leave application email +# SSHR_LEAVE_APPLICATION_EMAIL_SUBJ - subject of leave application email +# SSHR_OVERTIME_PROCESSED_EMAIL_TXT - text of processed overtime email +# SSHR_OVERTIME_PROCESSED_EMAIL_SUBJ - subject of processed overtime email +# SSHR_OVERTIME_APPLICATION_EMAIL_TXT - text of overtime application email +# SSHR_OVERTIME_APPLICATION_EMAIL_SUBJ - subject of overtime application email From 05864abb8331fbb0d4163f7fd6dadb52cab1dc65 Mon Sep 17 00:00:00 2001 From: Kelvin Jayanoris Date: Sun, 10 Feb 2019 23:15:02 +0300 Subject: [PATCH 04/11] Add templates for overtime and leave application emails --- .../email/leave_application_email_body.html | 7 +++++++ .../email/leave_application_email_body.txt | 9 +++++++++ .../email/leave_application_email_subject.txt | 1 + .../email/overtime_application_email_body.html | 7 +++++++ .../email/overtime_application_email_body.txt | 9 +++++++++ .../email/overtime_application_email_subject.txt | 1 + 6 files changed, 34 insertions(+) create mode 100644 small_small_hr/templates/small_small_hr/email/leave_application_email_body.html create mode 100644 small_small_hr/templates/small_small_hr/email/leave_application_email_body.txt create mode 100644 small_small_hr/templates/small_small_hr/email/leave_application_email_subject.txt create mode 100644 small_small_hr/templates/small_small_hr/email/overtime_application_email_body.html create mode 100644 small_small_hr/templates/small_small_hr/email/overtime_application_email_body.txt create mode 100644 small_small_hr/templates/small_small_hr/email/overtime_application_email_subject.txt diff --git a/small_small_hr/templates/small_small_hr/email/leave_application_email_body.html b/small_small_hr/templates/small_small_hr/email/leave_application_email_body.html new file mode 100644 index 0000000..7fed0ef --- /dev/null +++ b/small_small_hr/templates/small_small_hr/email/leave_application_email_body.html @@ -0,0 +1,7 @@ +Hello {{name}},

+{{message|linebreaks}} +

+Thank you,
+{{SITE.name}}
+------
+http://{{SITE.domain}} diff --git a/small_small_hr/templates/small_small_hr/email/leave_application_email_body.txt b/small_small_hr/templates/small_small_hr/email/leave_application_email_body.txt new file mode 100644 index 0000000..ac06063 --- /dev/null +++ b/small_small_hr/templates/small_small_hr/email/leave_application_email_body.txt @@ -0,0 +1,9 @@ +Hello {{name}}, + +{{message}} + +Thank you, + +{{SITE.name}} +------ +http://{{SITE.domain}} diff --git a/small_small_hr/templates/small_small_hr/email/leave_application_email_subject.txt b/small_small_hr/templates/small_small_hr/email/leave_application_email_subject.txt new file mode 100644 index 0000000..b975387 --- /dev/null +++ b/small_small_hr/templates/small_small_hr/email/leave_application_email_subject.txt @@ -0,0 +1 @@ +{{subject}} \ No newline at end of file diff --git a/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.html b/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.html new file mode 100644 index 0000000..7fed0ef --- /dev/null +++ b/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.html @@ -0,0 +1,7 @@ +Hello {{name}},

+{{message|linebreaks}} +

+Thank you,
+{{SITE.name}}
+------
+http://{{SITE.domain}} diff --git a/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.txt b/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.txt new file mode 100644 index 0000000..ac06063 --- /dev/null +++ b/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.txt @@ -0,0 +1,9 @@ +Hello {{name}}, + +{{message}} + +Thank you, + +{{SITE.name}} +------ +http://{{SITE.domain}} diff --git a/small_small_hr/templates/small_small_hr/email/overtime_application_email_subject.txt b/small_small_hr/templates/small_small_hr/email/overtime_application_email_subject.txt new file mode 100644 index 0000000..b975387 --- /dev/null +++ b/small_small_hr/templates/small_small_hr/email/overtime_application_email_subject.txt @@ -0,0 +1 @@ +{{subject}} \ No newline at end of file From fb2da2b5eb1afb3c023bb97ca62341c644370196 Mon Sep 17 00:00:00 2001 From: Kelvin Jayanoris Date: Sun, 10 Feb 2019 23:15:46 +0300 Subject: [PATCH 05/11] Use different template for overtime and leave application emails --- small_small_hr/emails.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/small_small_hr/emails.py b/small_small_hr/emails.py index eb79966..ee9e9ac 100644 --- a/small_small_hr/emails.py +++ b/small_small_hr/emails.py @@ -10,9 +10,17 @@ def send_email( # pylint: disable=too-many-arguments name: str, email: str, subject: str, message: str, obj: object = None, - cc_list: list = None): + cc_list: list = None, template: str = 'generic'): """ Sends a generic email + + :param name: name of person + :param email: email address to send to + :param subject: the email's subject + :param message: the email's body text + :param obj: the object in question + :param cc_list: the list of email address to "CC" + :param template: the template to use """ context = { 'name': name, @@ -22,12 +30,12 @@ def send_email( # pylint: disable=too-many-arguments 'SITE': Site.objects.get_current() } email_subject = render_to_string( - 'small_small_hr/email/generic_email_subject.txt', + f'small_small_hr/email/{template}_email_subject.txt', context).replace('\n', '') email_txt_body = render_to_string( - 'small_small_hr/email/generic_email_body.txt', context) + f'small_small_hr/email/{template}_email_body.txt', context) email_html_body = render_to_string( - 'small_small_hr/email/generic_email_body.html', context + f'small_small_hr/email/{template}_email_body.html', context ).replace('\n', '') subject = email_subject @@ -64,7 +72,8 @@ def leave_application_email(leave_obj: object): email=admin_email, subject=subj, message=msg, - obj=leave_obj + obj=leave_obj, + template='leave_application' ) @@ -113,7 +122,8 @@ def overtime_application_email(overtime_obj: object): email=admin_email, subject=subj, message=msg, - obj=overtime_obj + obj=overtime_obj, + template='overtime_application' ) From de7c9a6a49f54d7acd342e9773c247a0b3cce111 Mon Sep 17 00:00:00 2001 From: Kelvin Jayanoris Date: Tue, 12 Feb 2019 22:05:27 +0300 Subject: [PATCH 06/11] Add tests for email templates --- tests/test_emails.py | 126 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 123 insertions(+), 3 deletions(-) diff --git a/tests/test_emails.py b/tests/test_emails.py index e77e075..abeb5b1 100644 --- a/tests/test_emails.py +++ b/tests/test_emails.py @@ -2,7 +2,7 @@ Module to test small_small_hr Emails """ from datetime import datetime -from unittest.mock import patch +from unittest.mock import call, patch from django.conf import settings from django.core import mail @@ -59,7 +59,8 @@ def test_leave_application_email(self, mock): email="hr@example.com", subject="New Leave Application", message="There has been a new leave application. Please log in to process it.", # noqa - obj=leave + obj=leave, + template="leave_application", ) @patch('small_small_hr.emails.send_email') @@ -107,7 +108,8 @@ def test_overtime_application_email(self, mock): email="ot@example.com", subject="New Overtime Application", message="There has been a new overtime application. Please log in to process it.", # noqa - obj=overtime + obj=overtime, + template="overtime_application", ) @patch('small_small_hr.emails.send_email') @@ -163,3 +165,121 @@ def test_send_email(self): mail.outbox[0].alternatives[0][0], 'Hello Bob Munro,

The quick brown fox.



' 'Thank you,
example.com
------
http://example.com') + + @patch('small_small_hr.emails.Site.objects.get_current') + @patch('small_small_hr.emails.render_to_string') + def test_send_email_templates(self, mock, site_mock): + """ + Test the templates used with send_email + """ + mock.return_value = "Some random text" + site_mock.return_value = 42 # ensure that this is predictable + + # test generic + data = { + 'name': 'Bob Munro', + 'email': 'bob@example.com', + 'subject': "I love oov", + 'message': "Its dangerous", + } + + send_email(**data) + + context = data.copy() + context.pop("email") + context["object"] = None + context["SITE"] = 42 + + expected_calls = [ + call( + "small_small_hr/email/generic_email_subject.txt", + context + ), + call( + "small_small_hr/email/generic_email_body.txt", + context + ), + call( + "small_small_hr/email/generic_email_body.html", + context + ) + ] + + mock.assert_has_calls(expected_calls) + + mock.reset_mock() + + # test leave + start = datetime( + 2017, 6, 5, 0, 0, 0, tzinfo=pytz.timezone(settings.TIME_ZONE)) + end = datetime( + 2017, 6, 10, 0, 0, 0, tzinfo=pytz.timezone(settings.TIME_ZONE)) + leave = mommy.make( + 'small_small_hr.Leave', staff=self.staffprofile, start=start, + end=end, leave_type=Leave.SICK, + status=Leave.PENDING) + + leave_application_email(leave) + + context = dict( + name="Bob Ndoe", + subject="New Leave Application", + message="There has been a new leave application. Please log in to process it.", # noqa + object=leave, + SITE=42 + ) + + expected_calls = [ + call( + "small_small_hr/email/leave_application_email_subject.txt", + context + ), + call( + "small_small_hr/email/leave_application_email_body.txt", + context + ), + call( + "small_small_hr/email/leave_application_email_body.html", + context + ) + ] + + mock.assert_has_calls(expected_calls) + + mock.reset_mock() + + # test overtime + start = datetime( + 2017, 6, 5, 0, 0, 0, tzinfo=pytz.timezone(settings.TIME_ZONE)) + end = datetime( + 2017, 6, 10, 0, 0, 0, tzinfo=pytz.timezone(settings.TIME_ZONE)) + overtime = mommy.make( + 'small_small_hr.OverTime', staff=self.staffprofile, start=start, + end=end, status=OverTime.PENDING) + + overtime_application_email(overtime) + + context = dict( + name="Bob Ndoe", + subject="New Overtime Application", + message="There has been a new overtime application. Please log in to process it.", # noqa + object=overtime, + SITE=42 + ) + + expected_calls = [ + call( + "small_small_hr/email/overtime_application_email_subject.txt", + context + ), + call( + "small_small_hr/email/overtime_application_email_body.txt", + context + ), + call( + "small_small_hr/email/overtime_application_email_body.html", + context + ) + ] + + mock.assert_has_calls(expected_calls) From be52a1f7caed2d34ebc7765d4341aa58d4693968 Mon Sep 17 00:00:00 2001 From: Kelvin Jayanoris Date: Tue, 12 Feb 2019 22:07:23 +0300 Subject: [PATCH 07/11] Fix pylint issue --- small_small_hr/emails.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/small_small_hr/emails.py b/small_small_hr/emails.py index ee9e9ac..576d6d9 100644 --- a/small_small_hr/emails.py +++ b/small_small_hr/emails.py @@ -8,7 +8,7 @@ from django.utils.translation import ugettext as _ -def send_email( # pylint: disable=too-many-arguments +def send_email( # pylint: disable=too-many-locals name: str, email: str, subject: str, message: str, obj: object = None, cc_list: list = None, template: str = 'generic'): """ From e3718307640177766ade5e1eca58d5c5f6ef57f5 Mon Sep 17 00:00:00 2001 From: Kelvin Jayanoris Date: Tue, 12 Feb 2019 22:10:46 +0300 Subject: [PATCH 08/11] Update django to fix vulnerability See: https://nvd.nist.gov/vuln/detail/CVE-2019-6975 --- Pipfile.lock | 12 ++++++------ setup.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Pipfile.lock b/Pipfile.lock index 6e361d2..416afa6 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -25,10 +25,10 @@ }, "django": { "hashes": [ - "sha256:a32c22af23634e1d11425574dce756098e015a165be02e4690179889b207c7a8", - "sha256:d6393918da830530a9516bbbcbf7f1214c3d733738779f06b0f649f49cc698c3" + "sha256:275bec66fd2588dd517ada59b8bfb23d4a9abc5a362349139ddda3c7ff6f5ade", + "sha256:939652e9d34d7d53d74d5d8ef82a19e5f8bb2de75618f7e5360691b6e9667963" ], - "version": "==2.1.5" + "version": "==2.1.7" }, "django-crispy-forms": { "hashes": [ @@ -221,10 +221,10 @@ }, "django": { "hashes": [ - "sha256:a32c22af23634e1d11425574dce756098e015a165be02e4690179889b207c7a8", - "sha256:d6393918da830530a9516bbbcbf7f1214c3d733738779f06b0f649f49cc698c3" + "sha256:275bec66fd2588dd517ada59b8bfb23d4a9abc5a362349139ddda3c7ff6f5ade", + "sha256:939652e9d34d7d53d74d5d8ef82a19e5f8bb2de75618f7e5360691b6e9667963" ], - "version": "==2.1.5" + "version": "==2.1.7" }, "entrypoints": { "hashes": [ diff --git a/setup.py b/setup.py index 34dcaea..0af29cf 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ url='https://github.com/moshthepitt/small-small-hr', packages=find_packages(exclude=['docs', 'tests']), install_requires=[ - 'Django >= 2.0.8', + 'Django >= 2.0.11', 'voluptuous', 'psycopg2-binary', 'sorl-thumbnail', From c6771fc281dfb608da042388397344038f430be4 Mon Sep 17 00:00:00 2001 From: Kelvin Jayanoris Date: Tue, 12 Feb 2019 22:12:23 +0300 Subject: [PATCH 09/11] =?UTF-8?q?=E2=86=91=20bump=20to=20version=200.1.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- small_small_hr/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/small_small_hr/__init__.py b/small_small_hr/__init__.py index d062cbe..2097b5b 100644 --- a/small_small_hr/__init__.py +++ b/small_small_hr/__init__.py @@ -1,7 +1,7 @@ """ Main init file for small_small_hr """ -VERSION = (0, 1, 4) +VERSION = (0, 1, 5) __version__ = '.'.join(str(v) for v in VERSION) # pylint: disable=invalid-name default_app_config = 'small_small_hr.apps.SmallSmallHrConfig' # noqa From 6d5303316cea65344d6f6a97fb94a93159b68968 Mon Sep 17 00:00:00 2001 From: Kelvin Jayanoris Date: Tue, 12 Feb 2019 22:41:33 +0300 Subject: [PATCH 10/11] Allow rejecting leave/overtime even when an overlapping approved object exists --- Pipfile | 2 +- small_small_hr/forms.py | 10 +++-- tests/test_forms.py | 99 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 5 deletions(-) diff --git a/Pipfile b/Pipfile index 4837c4f..dfbdc54 100644 --- a/Pipfile +++ b/Pipfile @@ -7,7 +7,7 @@ name = "pypi" python_version = "3.6" [packages] -"e1839a8" = {editable = true, path = "."} +e1839a8 = {editable = true,path = "."} [dev-packages] "flake8" = "*" diff --git a/small_small_hr/forms.py b/small_small_hr/forms.py index 01e1bf6..b9eefe6 100644 --- a/small_small_hr/forms.py +++ b/small_small_hr/forms.py @@ -182,12 +182,13 @@ def clean(self): start = cleaned_data.get('start') date = cleaned_data.get('date') staff = cleaned_data.get('staff') + status = cleaned_data.get('status') # end must be later than start if end <= start: self.add_error('end', _("end must be greater than start")) - # must not overlap within the same date + # must not overlap within the same date unless being rejected # pylint: disable=no-member overlap_qs = OverTime.objects.filter( date=date, staff=staff, status=OverTime.APPROVED).filter( @@ -196,7 +197,7 @@ def clean(self): if self.instance is not None: overlap_qs = overlap_qs.exclude(id=self.instance.id) - if overlap_qs.exists(): + if overlap_qs.exists() and status != OverTime.REJECTED: msg = _('you cannot have overlapping overtime hours on the ' 'same day') self.add_error('start', msg) @@ -337,6 +338,7 @@ def clean(self): staff = cleaned_data.get('staff') end = cleaned_data.get('end') start = cleaned_data.get('start') + status = cleaned_data.get('status') if all([staff, leave_type, start, end]): # end year and start year must be the same @@ -369,7 +371,7 @@ def clean(self): self.add_error('start', msg) self.add_error('end', msg) - # must not overlap + # must not overlap unless it is being rejected # pylint: disable=no-member overlap_qs = Leave.objects.filter( staff=staff, @@ -380,7 +382,7 @@ def clean(self): if self.instance is not None: overlap_qs = overlap_qs.exclude(id=self.instance.id) - if overlap_qs.exists(): + if overlap_qs.exists() and status != Leave.REJECTED: msg = _('you cannot have overlapping leave days') self.add_error('start', msg) self.add_error('end', msg) diff --git a/tests/test_forms.py b/tests/test_forms.py index d7fef4d..7ccceb2 100644 --- a/tests/test_forms.py +++ b/tests/test_forms.py @@ -256,6 +256,52 @@ def test_overtime_form_process(self): self.assertEqual(OverTime.APPROVED, overtime.status) self.assertEqual('Cool', overtime.comments) + def test_overtime_form_process_with_overlap(self): + """ + Test OverTimeForm with overlap for existing objects + """ + user = mommy.make('auth.User', first_name='Bob', last_name='Ndoe') + staffprofile = mommy.make('small_small_hr.StaffProfile', user=user) + + request = self.factory.get('/') + request.session = {} + request.user = AnonymousUser() + + # 6 hours of overtime + start = datetime( + 2017, 6, 5, 18, 0, 0, tzinfo=pytz.timezone(settings.TIME_ZONE)) + end = datetime( + 2017, 6, 5, 19, 0, 0, tzinfo=pytz.timezone(settings.TIME_ZONE)) + + # make sure object already exists + mommy.make( + 'small_small_hr.OverTime', start=start.time(), end=end.time(), + status=OverTime.APPROVED, date=start.date, staff=staffprofile) + + data = { + 'staff': staffprofile.id, + 'date': start.date(), + 'start': start.time(), + 'end': end.time(), + 'reason': 'Extra work', + 'status': OverTime.REJECTED, + 'comments': 'Already there' + } + + form = OverTimeForm(data=data) + self.assertTrue(form.is_valid()) + overtime = form.save() + self.assertEqual(staffprofile, overtime.staff) + self.assertEqual(start.date(), overtime.date) + self.assertEqual(start.time(), overtime.start) + self.assertEqual(end.time(), overtime.end) + self.assertEqual( + timedelta(seconds=3600).seconds, + overtime.get_duration().seconds) + self.assertEqual('Extra work', overtime.reason) + self.assertEqual(OverTime.REJECTED, overtime.status) + self.assertEqual('Already there', overtime.comments) + def test_overtime_form_start_end(self): """ Test OverTimeForm start end fields @@ -657,6 +703,59 @@ def test_leaveform_process(self): self.assertEqual(Leave.REJECTED, leave.status) self.assertEqual('Just no', leave.comments) + @override_settings(SSHR_DEFAULT_TIME=7) + def test_leaveform_process_with_overlap(self): + """ + Test LeaveForm process works even if leave object exists + """ + user = mommy.make('auth.User', first_name='Bob', last_name='Ndoe') + staffprofile = mommy.make('small_small_hr.StaffProfile', user=user) + staffprofile.leave_days = 21 + staffprofile.sick_days = 10 + staffprofile.save() + + request = self.factory.get('/') + request.session = {} + request.user = AnonymousUser() + + # 6 days of leave + start = datetime( + 2017, 6, 5, 7, 0, 0, tzinfo=pytz.timezone(settings.TIME_ZONE)) + end = datetime( + 2017, 6, 10, 7, 0, 0, tzinfo=pytz.timezone(settings.TIME_ZONE)) + + # make sure leave obj already exists for said dates + mommy.make( + 'small_small_hr.Leave', staff=staffprofile, start=start, + end=end, leave_type=Leave.REGULAR, + status=Leave.APPROVED) + + mommy.make('small_small_hr.AnnualLeave', staff=staffprofile, year=2017, + leave_type=Leave.REGULAR, carried_over_days=4) + + data = { + 'staff': staffprofile.id, + 'leave_type': Leave.REGULAR, + 'start': start, + 'end': end, + 'reason': 'Need a break', + 'comments': 'Already exists', + 'status': Leave.REJECTED + } + + form = LeaveForm(data=data) + self.assertTrue(form.is_valid()) + leave = form.save() + self.assertEqual(staffprofile, leave.staff) + self.assertEqual(Leave.REGULAR, leave.leave_type) + self.assertEqual(start, leave.start) + self.assertEqual(end, leave.end) + self.assertEqual( + timedelta(days=5).days, (leave.end - leave.start).days) + self.assertEqual('Need a break', leave.reason) + self.assertEqual(Leave.REJECTED, leave.status) + self.assertEqual('Already exists', leave.comments) + @override_settings(SSHR_DEFAULT_TIME=7) def test_sickleave_apply(self): """ From 512050a6e978a4ea69d6ce23273ea7cfaf595c0b Mon Sep 17 00:00:00 2001 From: Kelvin Jayanoris Date: Tue, 12 Feb 2019 22:46:15 +0300 Subject: [PATCH 11/11] Fix pylint issues --- small_small_hr/emails.py | 2 +- tests/test_forms.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/small_small_hr/emails.py b/small_small_hr/emails.py index 576d6d9..9e3637c 100644 --- a/small_small_hr/emails.py +++ b/small_small_hr/emails.py @@ -8,7 +8,7 @@ from django.utils.translation import ugettext as _ -def send_email( # pylint: disable=too-many-locals +def send_email( # pylint: disable=too-many-arguments, too-many-locals name: str, email: str, subject: str, message: str, obj: object = None, cc_list: list = None, template: str = 'generic'): """ diff --git a/tests/test_forms.py b/tests/test_forms.py index 7ccceb2..4576117 100644 --- a/tests/test_forms.py +++ b/tests/test_forms.py @@ -470,6 +470,8 @@ def test_leave_oversubscribe_off(self, mock): """ Test leave oversubscribe when SSHR_ALLOW_OVERSUBSCRIBE is False """ + mock.return_value = None + user = mommy.make('auth.User', first_name='Bob', last_name='Ndoe') staffprofile = mommy.make('small_small_hr.StaffProfile', user=user) staffprofile.leave_days = 21