Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • andersharrisson/netbox-awx-plugin
  • ics-infrastructure/netbox-awx-plugin
2 results
Show changes
Commits on Source (3)
......@@ -20,11 +20,9 @@ import urllib3
# Set up logging
logger = logging.getLogger(__name__)
# Suppress only the single InsecureRequestWarning from urllib3
urllib3.disable_warnings(InsecureRequestWarning)
# Configuration for retry mechanism
MAX_RETRIES = 5
MAX_RETRIES = 18
INITIAL_DELAY = 1
BACKOFF_FACTOR = 2
......
......@@ -16,7 +16,6 @@ from netbox_awx_plugin.synchronization import (
sync_host_group_association,
disassociate_removed_groups,
)
from netbox_awx_plugin.synchronization import serializers, group_prefixes
from django.contrib.contenttypes.models import ContentType
......@@ -60,6 +59,18 @@ class SynchronizationTestCase(TestCase):
self.device.primary_ip4 = self.ip_address
self.device.save()
# Patch 'get_current_job' to return a mock job
self.job_patcher = patch('netbox_awx_plugin.synchronization.get_current_job')
self.mock_get_current_job = self.job_patcher.start()
self.mock_job = Mock()
self.mock_job.meta = {}
self.mock_job.timeout = 180
self.mock_job.id = 'test-job-id'
self.mock_get_current_job.return_value = self.mock_job
def tearDown(self):
self.job_patcher.stop()
@patch('netbox_awx_plugin.models.AWXInventory.disassociate_host_group')
@patch('netbox_awx_plugin.models.AWXInventory.associate_host_group')
@patch('netbox_awx_plugin.models.AWXInventory.get_group')
......@@ -190,7 +201,6 @@ class SynchronizationTestCase(TestCase):
@patch('netbox_awx_plugin.models.AWXInventory.get_group')
def test_sync_virtual_machine(self, mock_get_group, mock_associate_host_group, mock_get_host, mock_create_host):
# Create a role for the virtual machine
vm_content_type = ContentType.objects.get_for_model(VirtualMachine)
vm_role = DeviceRole.objects.create(
name='Web Server',
slug='web-server'
......