Skip to content

Commit

Permalink
[deps] Updated netjsonconfig branch to gsoc23
Browse files Browse the repository at this point in the history
- Fixed test vpn deletion notification mock.
- Deleted ZT API tasks notification cache keys after vpn deletion.
  • Loading branch information
Aryamanz29 committed Jul 30, 2023
1 parent 737e05e commit 83bd932
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions openwisp_controller/config/base/vpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import shortuuid
from cache_memoize import cache_memoize
from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models, transaction
Expand Down Expand Up @@ -340,6 +341,8 @@ class method for ``post_delete`` signal
vpn_id=instance.pk,
)
)
# Delete ZT API tasks notification cache keys
cache.delete_many(cache.keys(f'*{instance.pk.hex}_last_operation'))

def _create_zerotier_server(self, config):
server_config = ZerotierService(
Expand Down
6 changes: 4 additions & 2 deletions openwisp_controller/config/tests/test_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,13 @@ def test_zerotier_api_tasks_notification(
mock_requests.delete.side_effect = [
# For delete network
self._get_mock_response(200, response={}),
# For controller leave network
self._get_mock_response(200, response={}),
]
vpn.delete()
self.assertEqual(Vpn.objects.count(), 0)
# Only logging for vpn deletion
self.assertEqual(mock_info.call_count, 1)
# Only logging for vpn deletion & leave network
self.assertEqual(mock_info.call_count, 2)
self.assertEqual(mock_warn.call_count, 0)
self.assertEqual(mock_error.call_count, 0)
self.assertEqual(notification_qs.count(), 0)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
django-sortedm2m~=3.1.1
django-reversion~=5.0.4
django-taggit~=4.0.0
netjsonconfig @ https://github.com/openwisp/netjsonconfig/tarball/issue-207/add-zerotier-to-openwrt-backend
netjsonconfig @ https://github.com/openwisp/netjsonconfig/tarball/gsoc23
django-x509 @ https://github.com/openwisp/django-x509/tarball/master
django-loci @ https://github.com/openwisp/django-loci/tarball/master
django-flat-json-widget @ https://github.com/openwisp/django-flat-json-widget/tarball/master
Expand Down

0 comments on commit 83bd932

Please sign in to comment.