summarylogtreecommitdiffstats
path: root/aws-cli-v2-8106.patch
blob: 28a33655bd9dc2e3f5a06bc53fef128578da60b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
diff -Naur awscli-2.15.40/awscli/customizations/eks/kubeconfig.py awscli-2.15.40_/awscli/customizations/eks/kubeconfig.py
--- awscli-2.15.40/awscli/customizations/eks/kubeconfig.py	2024-04-20 11:06:32.658178400 +0800
+++ awscli-2.15.40_/awscli/customizations/eks/kubeconfig.py	2024-04-20 11:09:03.390341218 +0800
@@ -70,6 +70,13 @@
         return name in [cluster['name']
                         for cluster in self.content['clusters'] if 'name' in cluster]
 
+    def __eq__(self, other):
+        return (
+            isinstance(other, Kubeconfig)
+            and self.path == other.path
+            and self.content == other.content
+        )
+
 
 class KubeconfigValidator(object):
     def __init__(self):
diff -Naur awscli-2.15.40/tests/functional/eks/test_kubeconfig.py awscli-2.15.40_/tests/functional/eks/test_kubeconfig.py
--- awscli-2.15.40/tests/functional/eks/test_kubeconfig.py	2024-04-20 11:06:32.568177140 +0800
+++ awscli-2.15.40_/tests/functional/eks/test_kubeconfig.py	2024-04-20 11:12:52.110419266 +0800
@@ -121,7 +121,7 @@
         ])
         loaded_config = self._loader.load_kubeconfig(simple_path)
         self.assertEqual(loaded_config.content, content)
-        self._validator.validate_config.called_with(Kubeconfig(simple_path,
+        self._validator.validate_config.assert_called_with(Kubeconfig(simple_path,
                                                                content))
 
     def test_load_noexist(self):
@@ -130,7 +130,7 @@
         loaded_config = self._loader.load_kubeconfig(no_exist_path)
         self.assertEqual(loaded_config.content,
                          _get_new_kubeconfig_content())
-        self._validator.validate_config.called_with(
+        self._validator.validate_config.assert_called_with(
             Kubeconfig(no_exist_path, _get_new_kubeconfig_content()))
 
     def test_load_empty(self):
@@ -138,7 +138,7 @@
         loaded_config = self._loader.load_kubeconfig(empty_path)
         self.assertEqual(loaded_config.content,
                          _get_new_kubeconfig_content())
-        self._validator.validate_config.called_with(
+        self._validator.validate_config.assert_called_with(
             Kubeconfig(empty_path,
                        _get_new_kubeconfig_content()))
 
@@ -147,4 +147,4 @@
         self.assertRaises(KubeconfigInaccessableError,
                           self._loader.load_kubeconfig,
                           current_directory)
-        self._validator.validate_config.assert_not_called()
\ No newline at end of file
+        self._validator.validate_config.assert_not_called()