@@ -81,22 +81,26 @@ def setUp(self):
81
81
@mock .patch (engine_client )
82
82
def test_push_image (self , mock_client ):
83
83
self .engine_client = mock_client
84
+ mock_client ().api ._auth_configs = {}
84
85
pusher = tasks .PushTask (self .conf , self .image )
85
86
pusher .run ()
86
87
mock_client ().images .push .assert_called_once_with (
87
- self .image .canonical_name , decode = True , stream = True )
88
+ self .image .canonical_name ,
89
+ decode = True , stream = True , auth_config = {})
88
90
self .assertTrue (pusher .success )
89
91
90
92
@mock .patch .dict (os .environ , clear = True )
91
93
@mock .patch (engine_client )
92
94
def test_push_image_failure (self , mock_client ):
93
95
"""failure on connecting Docker API"""
94
96
self .engine_client = mock_client
97
+ mock_client ().api ._auth_configs = {}
95
98
mock_client ().images .push .side_effect = Exception
96
99
pusher = tasks .PushTask (self .conf , self .image )
97
100
pusher .run ()
98
101
mock_client ().images .push .assert_called_once_with (
99
- self .image .canonical_name , decode = True , stream = True )
102
+ self .image .canonical_name ,
103
+ decode = True , stream = True , auth_config = {})
100
104
self .assertFalse (pusher .success )
101
105
self .assertEqual (utils .Status .PUSH_ERROR , self .image .status )
102
106
@@ -105,11 +109,13 @@ def test_push_image_failure(self, mock_client):
105
109
def test_push_image_failure_retry (self , mock_client ):
106
110
"""failure on connecting Docker API, success on retry"""
107
111
self .engine_client = mock_client
112
+ mock_client ().api ._auth_configs = {}
108
113
mock_client ().images .push .side_effect = [Exception , []]
109
114
pusher = tasks .PushTask (self .conf , self .image )
110
115
pusher .run ()
111
116
mock_client ().images .push .assert_called_once_with (
112
- self .image .canonical_name , decode = True , stream = True )
117
+ self .image .canonical_name ,
118
+ decode = True , stream = True , auth_config = {})
113
119
self .assertFalse (pusher .success )
114
120
self .assertEqual (utils .Status .PUSH_ERROR , self .image .status )
115
121
@@ -125,12 +131,14 @@ def test_push_image_failure_retry(self, mock_client):
125
131
def test_push_image_failure_error (self , mock_client ):
126
132
"""Docker connected, failure to push"""
127
133
self .engine_client = mock_client
134
+ mock_client ().api ._auth_configs = {}
128
135
mock_client ().images .push .return_value = [{'errorDetail' : {'message' :
129
136
'mock push fail' }}]
130
137
pusher = tasks .PushTask (self .conf , self .image )
131
138
pusher .run ()
132
139
mock_client ().images .push .assert_called_once_with (
133
- self .image .canonical_name , decode = True , stream = True )
140
+ self .image .canonical_name ,
141
+ decode = True , stream = True , auth_config = {})
134
142
self .assertFalse (pusher .success )
135
143
self .assertEqual (utils .Status .PUSH_ERROR , self .image .status )
136
144
@@ -139,12 +147,14 @@ def test_push_image_failure_error(self, mock_client):
139
147
def test_push_image_failure_error_retry (self , mock_client ):
140
148
"""Docker connected, failure to push, success on retry"""
141
149
self .engine_client = mock_client
150
+ mock_client ().api ._auth_configs = {}
142
151
mock_client ().images .push .return_value = [{'errorDetail' : {'message' :
143
152
'mock push fail' }}]
144
153
pusher = tasks .PushTask (self .conf , self .image )
145
154
pusher .run ()
146
155
mock_client ().images .push .assert_called_once_with (
147
- self .image .canonical_name , decode = True , stream = True )
156
+ self .image .canonical_name ,
157
+ decode = True , stream = True , auth_config = {})
148
158
self .assertFalse (pusher .success )
149
159
self .assertEqual (utils .Status .PUSH_ERROR , self .image .status )
150
160
0 commit comments