Exemple #1
0
 def test_allocate_executes_with_valid_params(self, args, m_allocate):
     m_allocate.return_value = {"ipv4": ["192.168.1.1"],
                        "ipv6": "dead:beef::",
                        "error": None}
     result = calico_mesos.allocate(args)
     self.assertTrue(m_allocate.called)
     self.assertEqual(result, '{"error": null, "ipv4": ["192.168.1.1"], "ipv6": "dead:beef::"}') 
Exemple #2
0
 def test_allocate_executes_with_static_addr(self, args, m_allocate, m_reserve):
     m_allocate.return_value = {"ipv4": [],
                        "ipv6": "dead:beef::",
                        "error": None}
     result = calico_mesos.allocate(args)
     self.assertEqual(result, '{"error": null, "ipv4": ["192.168.3.1"], "ipv6": "dead:beef::"}')
Exemple #3
0
 def test_error_messages_with_invalid_params(self, args, error, m_allocate):
     with self.assertRaises(IsolatorException) as e:
         calico_mesos.allocate(args)
     self.assertFalse(m_allocate.called)
     self.assertEqual(e.exception.message, error)
Exemple #4
0
 def test_allocate_executes_with_valid_params(self, args, m_allocate):
     result = calico_mesos.allocate(args)
     self.assertTrue(m_allocate.called)
     self.assertEqual(result, m_allocate())
Exemple #5
0
 def test_allocate_executes_with_valid_params(self, args, m_allocate):
     result = calico_mesos.allocate(args)
     self.assertTrue(m_allocate.called)
     self.assertEqual(result, m_allocate())
Exemple #6
0
 def test_error_messages_with_invalid_params(self, args, error, m_allocate):
     with self.assertRaises(IsolatorException) as e:
         calico_mesos.allocate(args)
     self.assertFalse(m_allocate.called)
     self.assertEqual(e.exception.message, error)