@@ -1781,18 +1781,21 @@ def test_inspect_container(self):
1781
1781
self .client .inspect_container (fake_api .FAKE_CONTAINER_ID )
1782
1782
except Exception as e :
1783
1783
self .fail ('Command should not raise exception: {0}' .format (e ))
1784
-
1785
- try :
1786
- self .client .inspect_container ('' )
1787
- except ValueError as e :
1788
- self .assertEqual (e .args [0 ],
1789
- 'image or container param is empty' )
1790
-
1791
1784
fake_request .assert_called_with (
1792
1785
url_prefix + 'containers/3cc2351ab11b/json' ,
1793
1786
timeout = DEFAULT_TIMEOUT_SECONDS
1794
1787
)
1795
1788
1789
+ def test_inspect_container_empty_id (self ):
1790
+ try :
1791
+ self .client .inspect_container ('' )
1792
+ except docker .errors .NullResource as e :
1793
+ self .assertEqual (
1794
+ e .args [0 ], 'image or container param is undefined'
1795
+ )
1796
+ else :
1797
+ self .fail ('Command expected NullResource exception' )
1798
+
1796
1799
def test_container_stats (self ):
1797
1800
try :
1798
1801
self .client .stats (fake_api .FAKE_CONTAINER_ID )
@@ -1959,17 +1962,21 @@ def test_inspect_image(self):
1959
1962
except Exception as e :
1960
1963
self .fail ('Command should not raise exception: {0}' .format (e ))
1961
1964
1962
- try :
1963
- self .client .inspect_image ('' )
1964
- except ValueError as e :
1965
- self .assertEqual (e .args [0 ],
1966
- 'image or container param is empty' )
1967
-
1968
1965
fake_request .assert_called_with (
1969
1966
url_prefix + 'images/test_image/json' ,
1970
1967
timeout = DEFAULT_TIMEOUT_SECONDS
1971
1968
)
1972
1969
1970
+ def test_inspect_image_empty_id (self ):
1971
+ try :
1972
+ self .client .inspect_image ('' )
1973
+ except docker .errors .NullResource as e :
1974
+ self .assertEqual (
1975
+ e .args [0 ], 'image or container param is undefined'
1976
+ )
1977
+ else :
1978
+ self .fail ('Command expected NullResource exception' )
1979
+
1973
1980
def test_insert_image (self ):
1974
1981
try :
1975
1982
self .client .insert (fake_api .FAKE_IMAGE_NAME ,
0 commit comments