@@ -192,19 +192,23 @@ def test_ulimit_invalid_type(self):
192
192
self .assertRaises (ValueError , lambda : Ulimit (name = 'hello' , hard = '456' ))
193
193
194
194
def test_create_host_config_dict_logconfig (self ):
195
- dct = {'type' : 'syslog' , 'config' : {'key1' : 'val1' }}
195
+ dct = {'type' : LogConfig . types . SYSLOG , 'config' : {'key1' : 'val1' }}
196
196
config = create_host_config (log_config = dct )
197
197
self .assertIn ('LogConfig' , config )
198
198
self .assertTrue (isinstance (config ['LogConfig' ], LogConfig ))
199
199
self .assertEqual (dct ['type' ], config ['LogConfig' ].type )
200
200
201
201
def test_create_host_config_obj_logconfig (self ):
202
- obj = LogConfig (type = 'syslog' , config = {'key1' : 'val1' })
202
+ obj = LogConfig (type = LogConfig . types . SYSLOG , config = {'key1' : 'val1' })
203
203
config = create_host_config (log_config = obj )
204
204
self .assertIn ('LogConfig' , config )
205
205
self .assertTrue (isinstance (config ['LogConfig' ], LogConfig ))
206
206
self .assertEqual (obj , config ['LogConfig' ])
207
207
208
+ def test_logconfig_invalid_config_type (self ):
209
+ with pytest .raises (ValueError ):
210
+ LogConfig (type = LogConfig .types .JSON , config = 'helloworld' )
211
+
208
212
def test_resolve_repository_name (self ):
209
213
# docker hub library image
210
214
self .assertEqual (
0 commit comments