1
+ import unittest
2
+ import warnings
3
+
1
4
from docker .constants import DEFAULT_DATA_CHUNK_SIZE
2
5
from docker .models .images import Image
3
- import unittest
4
6
5
7
from .fake_api import FAKE_IMAGE_ID
6
8
from .fake_api_client import make_fake_client
@@ -43,17 +45,19 @@ def test_load(self):
43
45
def test_pull (self ):
44
46
client = make_fake_client ()
45
47
image = client .images .pull ('test_image:latest' )
46
- client .api .pull .assert_called_with ('test_image' , tag = 'latest' ,
47
- stream = False )
48
+ client .api .pull .assert_called_with (
49
+ 'test_image' , tag = 'latest' , stream = True
50
+ )
48
51
client .api .inspect_image .assert_called_with ('test_image:latest' )
49
52
assert isinstance (image , Image )
50
53
assert image .id == FAKE_IMAGE_ID
51
54
52
55
def test_pull_multiple (self ):
53
56
client = make_fake_client ()
54
57
images = client .images .pull ('test_image' )
55
- client .api .pull .assert_called_with ('test_image' , tag = None ,
56
- stream = False )
58
+ client .api .pull .assert_called_with (
59
+ 'test_image' , tag = None , stream = True
60
+ )
57
61
client .api .images .assert_called_with (
58
62
all = False , name = 'test_image' , filters = None
59
63
)
@@ -63,6 +67,16 @@ def test_pull_multiple(self):
63
67
assert isinstance (image , Image )
64
68
assert image .id == FAKE_IMAGE_ID
65
69
70
+ def test_pull_with_stream_param (self ):
71
+ client = make_fake_client ()
72
+ with warnings .catch_warnings (record = True ) as w :
73
+ client .images .pull ('test_image' , stream = True )
74
+
75
+ assert len (w ) == 1
76
+ assert str (w [0 ].message ).startswith (
77
+ '`stream` is not a valid parameter'
78
+ )
79
+
66
80
def test_push (self ):
67
81
client = make_fake_client ()
68
82
client .images .push ('foobar' , insecure_registry = True )
0 commit comments