Exemple #1
0
 def test_create_with_valid_event_data(self):
     service_env = ServiceEnvironmentFactory()
     self.data['service']['uid'] = service_env.service.uid
     self.data['environment'] = service_env.environment.name
     self.assertEqual(VIP.objects.count(), 0)
     handle_create_vip_event(self.data)
     self.assertEqual(VIP.objects.count(), 1)
Exemple #2
0
    def test_create_when_vip_already_exists(self):
        vip = VIPFactory()
        self.data['ip'] = vip.ip.address
        self.data['port'] = vip.port
        self.data['protocol'] = VIPProtocol.from_id(vip.protocol).name

        vips = VIP.objects.all()
        self.assertEqual(vips.count(), 1)
        modified_before = vips[0].modified
        handle_create_vip_event(self.data)
        vips = VIP.objects.all()
        self.assertEqual(vips.count(), 1)
        self.assertEqual(vips[0].modified, modified_before)
Exemple #3
0
 def test_create_with_invalid_event_data(self):
     self.data['service'] = None
     self.assertEqual(VIP.objects.count(), 0)
     handle_create_vip_event(self.data)
     self.assertEqual(VIP.objects.count(), 0)
Exemple #4
0
 def test_create_when_service_env_does_not_exist(self):
     self.data['service']['uid'] = 'non-existing-uid'
     handle_create_vip_event(self.data)
     self.assertEqual(VIP.objects.count(), 0)