(self)
| 53 | clear_test_media_root() |
| 54 | |
| 55 | def test_task(self): |
| 56 | client = APIClient() |
| 57 | |
| 58 | with start_processing_node(): |
| 59 | user = User.objects.get(username="testuser") |
| 60 | self.assertFalse(user.is_superuser) |
| 61 | |
| 62 | other_user = User.objects.get(username="testuser2") |
| 63 | |
| 64 | project = Project.objects.create( |
| 65 | owner=user, |
| 66 | name="test project" |
| 67 | ) |
| 68 | other_project = Project.objects.create( |
| 69 | owner=other_user, |
| 70 | name="another test project" |
| 71 | ) |
| 72 | other_task = Task.objects.create(project=other_project) |
| 73 | |
| 74 | # Start processing node |
| 75 | |
| 76 | # Create processing node |
| 77 | pnode = ProcessingNode.objects.create(hostname="localhost", port=11223) |
| 78 | assign_perm('view_processingnode', user, pnode) |
| 79 | assign_perm('view_processingnode', other_user, pnode) |
| 80 | |
| 81 | # Verify that it's working |
| 82 | self.assertTrue(pnode.api_version is not None) |
| 83 | |
| 84 | # task creation via file upload |
| 85 | image1 = open("app/fixtures/tiny_drone_image.jpg", 'rb') |
| 86 | image2 = open("app/fixtures/tiny_drone_image_2.jpg", 'rb') |
| 87 | multispec_image = open("app/fixtures/tiny_drone_image_multispec.tif", 'rb') |
| 88 | |
| 89 | img1 = Image.open("app/fixtures/tiny_drone_image.jpg") |
| 90 | ms_img = Image.open("app/fixtures/tiny_drone_image_multispec.tif") |
| 91 | |
| 92 | img1_exif = img1.getexif().tobytes() |
| 93 | img1_xmp = img1.info.get('xmp') |
| 94 | self.assertTrue(img1_xmp is not None) |
| 95 | |
| 96 | # Check EXIF/XMP |
| 97 | |
| 98 | def extract_exif(file): |
| 99 | return subprocess.run(['exiftool', file], |
| 100 | capture_output=True, text=True, check=True).stdout.strip() |
| 101 | def extract_xmp(file): |
| 102 | return subprocess.run(['exiftool', '-xmp', '-b', file], |
| 103 | capture_output=True, text=True, check=True).stdout.strip() |
| 104 | |
| 105 | |
| 106 | img1_exif_dump = extract_exif('app/fixtures/tiny_drone_image.jpg') |
| 107 | self.assertTrue('''GPS Latitude : 41 deg 13' 34.93" N''' in img1_exif_dump) |
| 108 | |
| 109 | img1_xmp_dump = extract_xmp('app/fixtures/tiny_drone_image.jpg') |
| 110 | self.assertTrue('<sensefly:CamID>11</sensefly:CamID>' in img1_xmp_dump) |
| 111 | |
| 112 | # EXIF/XMP from multispec image |
nothing calls this directly
no test coverage detected