photo-objects 0.8.0__tar.gz → 0.8.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. {photo_objects-0.8.0 → photo_objects-0.8.2}/PKG-INFO +1 -1
  2. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/api/photo_change_request.py +1 -4
  3. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/tests/test_album.py +5 -8
  4. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/tests/test_photo.py +5 -9
  5. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/tests/test_photo_change_requests.py +5 -14
  6. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/tests/utils.py +9 -0
  7. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects.egg-info/PKG-INFO +1 -1
  8. {photo_objects-0.8.0 → photo_objects-0.8.2}/pyproject.toml +1 -1
  9. {photo_objects-0.8.0 → photo_objects-0.8.2}/LICENSE +0 -0
  10. {photo_objects-0.8.0 → photo_objects-0.8.2}/README.md +0 -0
  11. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/__init__.py +0 -0
  12. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/config.py +0 -0
  13. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/__init__.py +0 -0
  14. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/admin.py +0 -0
  15. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/api/__init__.py +0 -0
  16. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/api/album.py +0 -0
  17. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/api/auth.py +0 -0
  18. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/api/photo.py +0 -0
  19. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/api/utils.py +0 -0
  20. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/apps.py +0 -0
  21. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/conf.py +0 -0
  22. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/context_processors.py +0 -0
  23. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/forms.py +0 -0
  24. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/management/__init__.py +0 -0
  25. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/management/commands/__init__.py +0 -0
  26. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/management/commands/clean-scaled-photos.py +0 -0
  27. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/management/commands/create-initial-admin-account.py +0 -0
  28. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/migrations/0001_initial.py +0 -0
  29. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/migrations/0002_created_at_updated_at.py +0 -0
  30. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/migrations/0003_admin_visibility.py +0 -0
  31. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/migrations/0004_camera_setup_and_settings.py +0 -0
  32. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/migrations/0005_sitesettings.py +0 -0
  33. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/migrations/0006_photo_alt_text.py +0 -0
  34. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/migrations/__init__.py +0 -0
  35. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/models.py +0 -0
  36. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/objsto.py +0 -0
  37. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/signals.py +0 -0
  38. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/templatetags/__init__.py +0 -0
  39. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/templatetags/photo_objects_extras.py +0 -0
  40. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/tests/__init__.py +0 -0
  41. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/tests/test_auth.py +0 -0
  42. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/tests/test_commands.py +0 -0
  43. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/tests/test_img.py +0 -0
  44. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/tests/test_og_meta.py +0 -0
  45. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/tests/test_utils.py +0 -0
  46. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/urls.py +0 -0
  47. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/views/__init__.py +0 -0
  48. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/views/api/__init__.py +0 -0
  49. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/views/api/album.py +0 -0
  50. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/views/api/auth.py +0 -0
  51. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/views/api/photo.py +0 -0
  52. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/views/api/utils.py +0 -0
  53. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/views/ui/__init__.py +0 -0
  54. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/views/ui/album.py +0 -0
  55. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/views/ui/configuration.py +0 -0
  56. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/views/ui/photo.py +0 -0
  57. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/views/ui/photo_change_request.py +0 -0
  58. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/views/ui/users.py +0 -0
  59. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/views/ui/utils.py +0 -0
  60. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/django/views/utils.py +0 -0
  61. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/error.py +0 -0
  62. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/img.py +0 -0
  63. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects/utils.py +0 -0
  64. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects.egg-info/SOURCES.txt +0 -0
  65. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects.egg-info/dependency_links.txt +0 -0
  66. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects.egg-info/requires.txt +0 -0
  67. {photo_objects-0.8.0 → photo_objects-0.8.2}/photo_objects.egg-info/top_level.txt +0 -0
  68. {photo_objects-0.8.0 → photo_objects-0.8.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: photo-objects
3
- Version: 0.8.0
3
+ Version: 0.8.2
4
4
  Summary: Application for storing photos in S3 compatible object-storage.
5
5
  Author: Toni Kangas
6
6
  License: MIT License
@@ -57,10 +57,7 @@ def get_next_photo_change_request(request: HttpRequest):
57
57
 
58
58
 
59
59
  def get_expected_photo_change_requests(request: HttpRequest):
60
- check_permissions(
61
- request,
62
- 'photo_objects.change_photo',
63
- 'photo_objects.delete_photochangerequest')
60
+ check_permissions(request, 'photo_objects.add_photochangerequest')
64
61
 
65
62
  photos = Photo.objects.filter(
66
63
  alt_text="",
@@ -2,13 +2,13 @@ import json
2
2
  from time import sleep
3
3
 
4
4
  from django.contrib.auth import get_user_model
5
- from django.contrib.auth.models import Permission
6
5
 
7
6
  from photo_objects.django.models import Album
8
7
  from photo_objects.img import utcnow
9
8
 
10
9
  from .utils import (
11
10
  TestCase,
11
+ add_permissions,
12
12
  parse_timestamps,
13
13
  create_dummy_photo,
14
14
  open_test_photo
@@ -101,17 +101,14 @@ class AlbumViewTests(TestCase):
101
101
 
102
102
  has_permission = user.objects.create_user(
103
103
  username='has_permission', password='test')
104
- permissions = [
104
+ add_permissions(
105
+ has_permission,
105
106
  'add_album',
106
107
  'add_photo',
107
108
  'change_album',
108
109
  'delete_album',
109
- 'delete_photo']
110
- for permission in permissions:
111
- has_permission.user_permissions.add(
112
- Permission.objects.get(
113
- content_type__app_label='photo_objects',
114
- codename=permission))
110
+ 'delete_photo',
111
+ )
115
112
 
116
113
  def test_post_album_with_non_json_data_fails(self):
117
114
  login_success = self.client.login(
@@ -5,7 +5,6 @@ from time import sleep
5
5
  from unittest import mock
6
6
 
7
7
  from django.contrib.auth import get_user_model
8
- from django.contrib.auth.models import Permission
9
8
  from PIL import Image
10
9
  from urllib3.exceptions import HTTPError
11
10
 
@@ -13,7 +12,7 @@ from photo_objects.django.models import Album
13
12
  from photo_objects.img import utcnow
14
13
  from photo_objects.django.objsto import get_photo
15
14
 
16
- from .utils import TestCase, open_test_photo, parse_timestamps
15
+ from .utils import TestCase, add_permissions, open_test_photo, parse_timestamps
17
16
 
18
17
 
19
18
  class PhotoViewTests(TestCase):
@@ -23,16 +22,13 @@ class PhotoViewTests(TestCase):
23
22
 
24
23
  has_permission = user.objects.create_user(
25
24
  username='has_permission', password='test')
26
- permissions = [
25
+ add_permissions(
26
+ has_permission,
27
27
  'add_photo',
28
28
  'change_album',
29
29
  'change_photo',
30
- 'delete_photo']
31
- for permission in permissions:
32
- has_permission.user_permissions.add(
33
- Permission.objects.get(
34
- content_type__app_label='photo_objects',
35
- codename=permission))
30
+ 'delete_photo',
31
+ )
36
32
 
37
33
  Album.objects.create(
38
34
  key="test-photo-a",
@@ -1,10 +1,9 @@
1
1
  from django.contrib.auth import get_user_model
2
- from django.contrib.auth.models import Permission
3
2
 
4
3
  from photo_objects.django.models import Album
5
4
 
6
5
 
7
- from .utils import TestCase, create_dummy_photo
6
+ from .utils import TestCase, add_permissions, create_dummy_photo
8
7
 
9
8
 
10
9
  TEST_PREFIX = "test-photo-change-request"
@@ -27,15 +26,7 @@ class PhotoChangeRequestTests(TestCase):
27
26
 
28
27
  has_permission = user.objects.create_user(
29
28
  username='has_permission', password='test')
30
- permissions = [
31
- 'change_photo',
32
- 'delete_photochangerequest',
33
- ]
34
- for permission in permissions:
35
- has_permission.user_permissions.add(
36
- Permission.objects.get(
37
- content_type__app_label='photo_objects',
38
- codename=permission))
29
+ add_permissions(has_permission, 'add_photochangerequest')
39
30
 
40
31
  self.private_album = Album.objects.create(
41
32
  key=f"{TEST_PREFIX}-private", visibility=Album.Visibility.PRIVATE)
@@ -64,13 +55,13 @@ class PhotoChangeRequestTests(TestCase):
64
55
  self.assertEqual(len(photos), expected_count)
65
56
 
66
57
  def test_create_photo_change_requests(self):
67
- self.client.login(username="superuser", password='test')
58
+ self.client.login(username="has_permission", password='test')
68
59
 
69
60
  response = self.client.get(
70
61
  '/api/photo-change-requests/expected')
71
62
  self.assertEqual(response.status_code, 200)
72
63
  photos = _filter_by_test_prefix(response.json())
73
- self.assertEqual(len(photos), 3)
64
+ self.assertEqual(len(photos), 2)
74
65
 
75
66
  response = self.client.post(
76
67
  f'/api/albums/{TEST_PREFIX}-private/photos/001.jpg/change-requests', # noqa: E501
@@ -88,4 +79,4 @@ class PhotoChangeRequestTests(TestCase):
88
79
  '/api/photo-change-requests/expected')
89
80
  self.assertEqual(response.status_code, 200)
90
81
  photos = _filter_by_test_prefix(response.json())
91
- self.assertEqual(len(photos), 2)
82
+ self.assertEqual(len(photos), 1)
@@ -5,6 +5,7 @@ import shutil
5
5
  import tempfile
6
6
 
7
7
  from django.conf import settings
8
+ from django.contrib.auth.models import Permission
8
9
  from django.core.management import call_command
9
10
  from django.test import TestCase as DjangoTestCase, override_settings
10
11
  from django.utils import timezone
@@ -16,6 +17,14 @@ from photo_objects.django.models import Album, Photo
16
17
  from photo_objects.django.objsto import _objsto_access
17
18
 
18
19
 
20
+ def add_permissions(user, *permissions):
21
+ for permission in permissions:
22
+ user.user_permissions.add(
23
+ Permission.objects.get(
24
+ content_type__app_label='photo_objects',
25
+ codename=permission))
26
+
27
+
19
28
  def open_test_photo(filename):
20
29
  path = os.path.join(
21
30
  os.path.dirname(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: photo-objects
3
- Version: 0.8.0
3
+ Version: 0.8.2
4
4
  Summary: Application for storing photos in S3 compatible object-storage.
5
5
  Author: Toni Kangas
6
6
  License: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "photo-objects"
7
- version = "0.8.0"
7
+ version = "0.8.2"
8
8
  dependencies = [
9
9
  "markdown~=3.7",
10
10
  "minio~=7.2",
File without changes
File without changes
File without changes