File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Generated by Django 2.0.13 on 2021-08-26 19:29
2
+
3
+ from django .db import migrations , models
4
+ import sponsors .models
5
+
6
+
7
+ class Migration (migrations .Migration ):
8
+
9
+ dependencies = [
10
+ ('sponsors' , '0034_contract_document_docx' ),
11
+ ]
12
+
13
+ operations = [
14
+ migrations .AlterField (
15
+ model_name = 'contract' ,
16
+ name = 'document' ,
17
+ field = models .FileField (blank = True , upload_to = 'sponsors/contracts/' , verbose_name = 'Unsigned PDF' ),
18
+ ),
19
+ migrations .AlterField (
20
+ model_name = 'contract' ,
21
+ name = 'document_docx' ,
22
+ field = models .FileField (blank = True , upload_to = 'sponsors/contracts/docx/' , verbose_name = 'Unsigned Docx' ),
23
+ ),
24
+ migrations .AlterField (
25
+ model_name = 'contract' ,
26
+ name = 'signed_document' ,
27
+ field = models .FileField (blank = True , upload_to = sponsors .models .signed_contract_random_path , verbose_name = 'Signed PDF' ),
28
+ ),
29
+ ]
Original file line number Diff line number Diff line change
1
+ import os
1
2
from unittest .mock import Mock , patch
2
3
from model_bakery import baker
3
4
from datetime import timedelta , date
5
+ from pathlib import Path
4
6
5
7
from django .conf import settings
6
8
from django .test import TestCase
@@ -186,6 +188,14 @@ def setUp(self):
186
188
self .file = SimpleUploadedFile ("contract.txt" , b"Contract content" )
187
189
self .contract = baker .make_recipe ("sponsors.tests.empty_contract" , status = Contract .DRAFT )
188
190
191
+ def tearDown (self ):
192
+ try :
193
+ signed_file = Path (self .contract .signed_document .path )
194
+ if signed_file .exists ():
195
+ os .remove (str (signed_file .resolve ()))
196
+ except ValueError :
197
+ pass
198
+
189
199
@patch ("sponsors.models.uuid.uuid4" , Mock (return_value = "1234" ))
190
200
def test_execute_and_update_database_object (self ):
191
201
self .use_case .execute (self .contract , self .file )
You can’t perform that action at this time.
0 commit comments