def test_get_by_name_not_found(self):
     module = MagicMock()
     k = DOKubernetesInfo(module)
     k.get_all_clusters = MagicMock()
     k.get_all_clusters.return_value = {
         "kubernetes_clusters": [{
             "name": "foo"
         }]
     }
     self.assertIsNone(k.get_by_name("foo2"))
 def test_get_kubernetes_when_not_found(self):
     module = MagicMock()
     k = DOKubernetesInfo(module)
     k.get_by_name = MagicMock()
     k.get_by_name.return_value = None
     self.assertIsNone(k.get_kubernetes())
 def test_get_kubernetes_when_found(self):
     module = MagicMock()
     k = DOKubernetesInfo(module)
     k.get_by_name = MagicMock()
     k.get_by_name.return_value = {"id": 42}
     self.assertEqual(k.get_kubernetes(), {"id": 42})
 def test_get_by_name_none(self):
     module = MagicMock()
     k = DOKubernetesInfo(module)
     self.assertIsNone(k.get_by_name(None))