File: fix-test.patch

package info (click to toggle)
python-heatclient 4.3.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,680 kB
  • sloc: python: 18,486; makefile: 93; sh: 2
file content (111 lines) | stat: -rw-r--r-- 4,756 bytes parent folder | download
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 python-heatclient (4.3.0-2) unstable; urgency=medium
 .
   * Uploading to unstable.
Author: Thomas Goirand <zigo@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
Bug: <upstream-bugtracker-url>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: (no|not-needed|<patch-forwarded-url>)
Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
Reviewed-By: <name and email of someone who approved/reviewed the patch>
Last-Update: 2025-12-26

Index: python-heatclient/heatclient/tests/unit/test_template_utils.py
===================================================================
--- python-heatclient.orig/heatclient/tests/unit/test_template_utils.py
+++ python-heatclient/heatclient/tests/unit/test_template_utils.py
@@ -20,6 +20,7 @@ from oslo_serialization import base64
 import testtools
 from testtools import matchers
 from urllib import error
+from urllib.parse import urlparse
 import yaml
 
 from heatclient.common import template_utils
@@ -27,6 +28,13 @@ from heatclient.common import utils
 from heatclient import exc
 
 
+def assert_url_called(mock, expected_url):
+    called_url = mock.call_args[0][0]
+    a = urlparse(called_url)
+    e = urlparse(expected_url)
+    assert a.scheme == e.scheme
+    assert a.path == e.path
+
 class ShellEnvironmentTest(testtools.TestCase):
 
     template_a = b'{"heat_template_version": "2013-05-23"}'
@@ -65,7 +73,7 @@ class ShellEnvironmentTest(testtools.Tes
                 'bar': {'hooks': 'pre_create',
                         'restricted_actions': 'replace'}}}},
             env_dict)
-        mock_url.assert_called_with('file://%s' % env_file)
+        assert_url_called(mock_url, 'file://%s' % env_file)
 
     @mock.patch('urllib.request.urlopen')
     def test_process_environment_file(self, mock_url):
@@ -209,7 +217,7 @@ class ShellEnvironmentTest(testtools.Tes
 
         self.assertEqual({}, env_dict)
         self.assertEqual({}, files)
-        mock_url.assert_called_with('file://%s' % env_file)
+        assert_url_called(mock_url, 'file://%s' % env_file)
 
     def test_no_process_environment_and_files(self):
         files, env = template_utils.process_environment_and_files()
Index: python-heatclient/heatclient/tests/unit/test_shell.py
===================================================================
--- python-heatclient.orig/heatclient/tests/unit/test_shell.py
+++ python-heatclient/heatclient/tests/unit/test_shell.py
@@ -1224,8 +1224,10 @@ class ShellTestUserPass(ShellBase):
 
         self.useFixture(fixtures.MockPatchObject(utils, 'read_url_content',
                                                  return_value='xxxxxx'))
-        url = 'file://' + request.pathname2url(
-            '%s/private_key.env' % TEST_VAR_DIR)
+        url = utils.normalise_file_path_to_url(
+                  'file://' + request.pathname2url(
+                      '%s/private_key.env' % TEST_VAR_DIR)
+              )
 
         template_file = os.path.join(TEST_VAR_DIR, 'minimal.template')
         create_text = self.shell(
@@ -1255,8 +1257,10 @@ class ShellTestUserPass(ShellBase):
 
         self.useFixture(fixtures.MockPatchObject(utils, 'read_url_content',
                                                  return_value='xxxxxx'))
-        url = 'file://' + request.pathname2url(
-            '%s/private_key.env' % TEST_VAR_DIR)
+        url = utils.normalise_file_path_to_url(
+                  'file://' + request.pathname2url(
+                '%s/private_key.env' % TEST_VAR_DIR)
+              )
 
         template_file = os.path.join(TEST_VAR_DIR, 'minimal.template')
         create_text = self.shell(
@@ -3563,8 +3567,8 @@ class ShellTestConfig(ShellBase):
 
         self.assertEqual(resp_dict['software_config'], jsonutils.loads(text))
         request.urlopen.assert_has_calls([
-            mock.call('file:///tmp/defn'),
-            mock.call('file:///tmp/config_script'),
+            mock.call(utils.normalise_file_path_to_url('file:///tmp/defn')),
+            mock.call(utils.normalise_file_path_to_url('file:///tmp/config_script')),
         ])
 
     def test_config_show(self):