@@ -24,7 +24,8 @@ def test_start_container(self):
24
24
self .client .start (fake_api .FAKE_CONTAINER_ID )
25
25
26
26
args = fake_request .call_args
27
- assert args [0 ][1 ] == url_prefix + 'containers/3cc2351ab11b/start'
27
+ assert args [0 ][1 ] == (url_prefix + 'containers/' +
28
+ fake_api .FAKE_CONTAINER_ID + '/start' )
28
29
assert 'data' not in args [1 ]
29
30
assert args [1 ]['timeout' ] == DEFAULT_TIMEOUT_SECONDS
30
31
@@ -117,7 +118,8 @@ def test_start_container_with_dict_instead_of_id(self):
117
118
self .client .start ({'Id' : fake_api .FAKE_CONTAINER_ID })
118
119
119
120
args = fake_request .call_args
120
- assert args [0 ][1 ] == url_prefix + 'containers/3cc2351ab11b/start'
121
+ assert args [0 ][1 ] == (url_prefix + 'containers/' +
122
+ fake_api .FAKE_CONTAINER_ID + '/start' )
121
123
assert 'data' not in args [1 ]
122
124
assert args [1 ]['timeout' ] == DEFAULT_TIMEOUT_SECONDS
123
125
@@ -1079,7 +1081,8 @@ def test_resize_container(self):
1079
1081
1080
1082
fake_request .assert_called_with (
1081
1083
'POST' ,
1082
- url_prefix + 'containers/3cc2351ab11b/resize' ,
1084
+ (url_prefix + 'containers/' +
1085
+ fake_api .FAKE_CONTAINER_ID + '/resize' ),
1083
1086
params = {'h' : 15 , 'w' : 120 },
1084
1087
timeout = DEFAULT_TIMEOUT_SECONDS
1085
1088
)
@@ -1092,7 +1095,8 @@ def test_rename_container(self):
1092
1095
1093
1096
fake_request .assert_called_with (
1094
1097
'POST' ,
1095
- url_prefix + 'containers/3cc2351ab11b/rename' ,
1098
+ (url_prefix + 'containers/' +
1099
+ fake_api .FAKE_CONTAINER_ID + '/rename' ),
1096
1100
params = {'name' : 'foobar' },
1097
1101
timeout = DEFAULT_TIMEOUT_SECONDS
1098
1102
)
@@ -1102,7 +1106,7 @@ def test_wait(self):
1102
1106
1103
1107
fake_request .assert_called_with (
1104
1108
'POST' ,
1105
- url_prefix + 'containers/3cc2351ab11b /wait' ,
1109
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /wait' ,
1106
1110
timeout = None ,
1107
1111
params = {}
1108
1112
)
@@ -1112,7 +1116,7 @@ def test_wait_with_dict_instead_of_id(self):
1112
1116
1113
1117
fake_request .assert_called_with (
1114
1118
'POST' ,
1115
- url_prefix + 'containers/3cc2351ab11b /wait' ,
1119
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /wait' ,
1116
1120
timeout = None ,
1117
1121
params = {}
1118
1122
)
@@ -1124,7 +1128,7 @@ def test_logs(self):
1124
1128
1125
1129
fake_request .assert_called_with (
1126
1130
'GET' ,
1127
- url_prefix + 'containers/3cc2351ab11b /logs' ,
1131
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /logs' ,
1128
1132
params = {'timestamps' : 0 , 'follow' : 0 , 'stderr' : 1 , 'stdout' : 1 ,
1129
1133
'tail' : 'all' },
1130
1134
timeout = DEFAULT_TIMEOUT_SECONDS ,
@@ -1140,7 +1144,7 @@ def test_logs_with_dict_instead_of_id(self):
1140
1144
1141
1145
fake_request .assert_called_with (
1142
1146
'GET' ,
1143
- url_prefix + 'containers/3cc2351ab11b /logs' ,
1147
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /logs' ,
1144
1148
params = {'timestamps' : 0 , 'follow' : 0 , 'stderr' : 1 , 'stdout' : 1 ,
1145
1149
'tail' : 'all' },
1146
1150
timeout = DEFAULT_TIMEOUT_SECONDS ,
@@ -1157,7 +1161,7 @@ def test_log_streaming(self):
1157
1161
1158
1162
fake_request .assert_called_with (
1159
1163
'GET' ,
1160
- url_prefix + 'containers/3cc2351ab11b /logs' ,
1164
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /logs' ,
1161
1165
params = {'timestamps' : 0 , 'follow' : 0 , 'stderr' : 1 , 'stdout' : 1 ,
1162
1166
'tail' : 'all' },
1163
1167
timeout = DEFAULT_TIMEOUT_SECONDS ,
@@ -1172,7 +1176,7 @@ def test_log_following(self):
1172
1176
1173
1177
fake_request .assert_called_with (
1174
1178
'GET' ,
1175
- url_prefix + 'containers/3cc2351ab11b /logs' ,
1179
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /logs' ,
1176
1180
params = {'timestamps' : 0 , 'follow' : 1 , 'stderr' : 1 , 'stdout' : 1 ,
1177
1181
'tail' : 'all' },
1178
1182
timeout = DEFAULT_TIMEOUT_SECONDS ,
@@ -1186,7 +1190,7 @@ def test_log_following_backwards(self):
1186
1190
1187
1191
fake_request .assert_called_with (
1188
1192
'GET' ,
1189
- url_prefix + 'containers/3cc2351ab11b /logs' ,
1193
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /logs' ,
1190
1194
params = {'timestamps' : 0 , 'follow' : 1 , 'stderr' : 1 , 'stdout' : 1 ,
1191
1195
'tail' : 'all' },
1192
1196
timeout = DEFAULT_TIMEOUT_SECONDS ,
@@ -1201,7 +1205,7 @@ def test_log_streaming_and_following(self):
1201
1205
1202
1206
fake_request .assert_called_with (
1203
1207
'GET' ,
1204
- url_prefix + 'containers/3cc2351ab11b /logs' ,
1208
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /logs' ,
1205
1209
params = {'timestamps' : 0 , 'follow' : 1 , 'stderr' : 1 , 'stdout' : 1 ,
1206
1210
'tail' : 'all' },
1207
1211
timeout = DEFAULT_TIMEOUT_SECONDS ,
@@ -1217,7 +1221,7 @@ def test_log_tail(self):
1217
1221
1218
1222
fake_request .assert_called_with (
1219
1223
'GET' ,
1220
- url_prefix + 'containers/3cc2351ab11b /logs' ,
1224
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /logs' ,
1221
1225
params = {'timestamps' : 0 , 'follow' : 0 , 'stderr' : 1 , 'stdout' : 1 ,
1222
1226
'tail' : 10 },
1223
1227
timeout = DEFAULT_TIMEOUT_SECONDS ,
@@ -1233,7 +1237,7 @@ def test_log_since(self):
1233
1237
1234
1238
fake_request .assert_called_with (
1235
1239
'GET' ,
1236
- url_prefix + 'containers/3cc2351ab11b /logs' ,
1240
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /logs' ,
1237
1241
params = {'timestamps' : 0 , 'follow' : 0 , 'stderr' : 1 , 'stdout' : 1 ,
1238
1242
'tail' : 'all' , 'since' : ts },
1239
1243
timeout = DEFAULT_TIMEOUT_SECONDS ,
@@ -1250,7 +1254,7 @@ def test_log_since_with_datetime(self):
1250
1254
1251
1255
fake_request .assert_called_with (
1252
1256
'GET' ,
1253
- url_prefix + 'containers/3cc2351ab11b /logs' ,
1257
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /logs' ,
1254
1258
params = {'timestamps' : 0 , 'follow' : 0 , 'stderr' : 1 , 'stdout' : 1 ,
1255
1259
'tail' : 'all' , 'since' : ts },
1256
1260
timeout = DEFAULT_TIMEOUT_SECONDS ,
@@ -1276,7 +1280,7 @@ def test_log_tty(self):
1276
1280
assert m .called
1277
1281
fake_request .assert_called_with (
1278
1282
'GET' ,
1279
- url_prefix + 'containers/3cc2351ab11b /logs' ,
1283
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /logs' ,
1280
1284
params = {'timestamps' : 0 , 'follow' : 1 , 'stderr' : 1 , 'stdout' : 1 ,
1281
1285
'tail' : 'all' },
1282
1286
timeout = DEFAULT_TIMEOUT_SECONDS ,
@@ -1288,7 +1292,8 @@ def test_diff(self):
1288
1292
1289
1293
fake_request .assert_called_with (
1290
1294
'GET' ,
1291
- url_prefix + 'containers/3cc2351ab11b/changes' ,
1295
+ (url_prefix + 'containers/' +
1296
+ fake_api .FAKE_CONTAINER_ID + '/changes' ),
1292
1297
timeout = DEFAULT_TIMEOUT_SECONDS
1293
1298
)
1294
1299
@@ -1297,7 +1302,8 @@ def test_diff_with_dict_instead_of_id(self):
1297
1302
1298
1303
fake_request .assert_called_with (
1299
1304
'GET' ,
1300
- url_prefix + 'containers/3cc2351ab11b/changes' ,
1305
+ (url_prefix + 'containers/' +
1306
+ fake_api .FAKE_CONTAINER_ID + '/changes' ),
1301
1307
timeout = DEFAULT_TIMEOUT_SECONDS
1302
1308
)
1303
1309
@@ -1306,7 +1312,7 @@ def test_port(self):
1306
1312
1307
1313
fake_request .assert_called_with (
1308
1314
'GET' ,
1309
- url_prefix + 'containers/3cc2351ab11b /json' ,
1315
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /json' ,
1310
1316
timeout = DEFAULT_TIMEOUT_SECONDS
1311
1317
)
1312
1318
@@ -1317,7 +1323,7 @@ def test_stop_container(self):
1317
1323
1318
1324
fake_request .assert_called_with (
1319
1325
'POST' ,
1320
- url_prefix + 'containers/3cc2351ab11b /stop' ,
1326
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /stop' ,
1321
1327
params = {'t' : timeout },
1322
1328
timeout = (DEFAULT_TIMEOUT_SECONDS + timeout )
1323
1329
)
@@ -1330,7 +1336,7 @@ def test_stop_container_with_dict_instead_of_id(self):
1330
1336
1331
1337
fake_request .assert_called_with (
1332
1338
'POST' ,
1333
- url_prefix + 'containers/3cc2351ab11b /stop' ,
1339
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /stop' ,
1334
1340
params = {'t' : timeout },
1335
1341
timeout = (DEFAULT_TIMEOUT_SECONDS + timeout )
1336
1342
)
@@ -1340,7 +1346,8 @@ def test_pause_container(self):
1340
1346
1341
1347
fake_request .assert_called_with (
1342
1348
'POST' ,
1343
- url_prefix + 'containers/3cc2351ab11b/pause' ,
1349
+ (url_prefix + 'containers/' +
1350
+ fake_api .FAKE_CONTAINER_ID + '/pause' ),
1344
1351
timeout = (DEFAULT_TIMEOUT_SECONDS )
1345
1352
)
1346
1353
@@ -1349,7 +1356,8 @@ def test_unpause_container(self):
1349
1356
1350
1357
fake_request .assert_called_with (
1351
1358
'POST' ,
1352
- url_prefix + 'containers/3cc2351ab11b/unpause' ,
1359
+ (url_prefix + 'containers/' +
1360
+ fake_api .FAKE_CONTAINER_ID + '/unpause' ),
1353
1361
timeout = (DEFAULT_TIMEOUT_SECONDS )
1354
1362
)
1355
1363
@@ -1358,7 +1366,7 @@ def test_kill_container(self):
1358
1366
1359
1367
fake_request .assert_called_with (
1360
1368
'POST' ,
1361
- url_prefix + 'containers/3cc2351ab11b /kill' ,
1369
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /kill' ,
1362
1370
params = {},
1363
1371
timeout = DEFAULT_TIMEOUT_SECONDS
1364
1372
)
@@ -1368,7 +1376,7 @@ def test_kill_container_with_dict_instead_of_id(self):
1368
1376
1369
1377
fake_request .assert_called_with (
1370
1378
'POST' ,
1371
- url_prefix + 'containers/3cc2351ab11b /kill' ,
1379
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /kill' ,
1372
1380
params = {},
1373
1381
timeout = DEFAULT_TIMEOUT_SECONDS
1374
1382
)
@@ -1378,7 +1386,7 @@ def test_kill_container_with_signal(self):
1378
1386
1379
1387
fake_request .assert_called_with (
1380
1388
'POST' ,
1381
- url_prefix + 'containers/3cc2351ab11b /kill' ,
1389
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /kill' ,
1382
1390
params = {'signal' : signal .SIGTERM },
1383
1391
timeout = DEFAULT_TIMEOUT_SECONDS
1384
1392
)
@@ -1388,7 +1396,8 @@ def test_restart_container(self):
1388
1396
1389
1397
fake_request .assert_called_with (
1390
1398
'POST' ,
1391
- url_prefix + 'containers/3cc2351ab11b/restart' ,
1399
+ (url_prefix + 'containers/' +
1400
+ fake_api .FAKE_CONTAINER_ID + '/restart' ),
1392
1401
params = {'t' : 2 },
1393
1402
timeout = (DEFAULT_TIMEOUT_SECONDS + 2 )
1394
1403
)
@@ -1398,7 +1407,8 @@ def test_restart_container_with_dict_instead_of_id(self):
1398
1407
1399
1408
fake_request .assert_called_with (
1400
1409
'POST' ,
1401
- url_prefix + 'containers/3cc2351ab11b/restart' ,
1410
+ (url_prefix + 'containers/' +
1411
+ fake_api .FAKE_CONTAINER_ID + '/restart' ),
1402
1412
params = {'t' : 2 },
1403
1413
timeout = (DEFAULT_TIMEOUT_SECONDS + 2 )
1404
1414
)
@@ -1408,7 +1418,7 @@ def test_remove_container(self):
1408
1418
1409
1419
fake_request .assert_called_with (
1410
1420
'DELETE' ,
1411
- url_prefix + 'containers/3cc2351ab11b' ,
1421
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID ,
1412
1422
params = {'v' : False , 'link' : False , 'force' : False },
1413
1423
timeout = DEFAULT_TIMEOUT_SECONDS
1414
1424
)
@@ -1418,7 +1428,7 @@ def test_remove_container_with_dict_instead_of_id(self):
1418
1428
1419
1429
fake_request .assert_called_with (
1420
1430
'DELETE' ,
1421
- url_prefix + 'containers/3cc2351ab11b' ,
1431
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID ,
1422
1432
params = {'v' : False , 'link' : False , 'force' : False },
1423
1433
timeout = DEFAULT_TIMEOUT_SECONDS
1424
1434
)
@@ -1428,7 +1438,8 @@ def test_export(self):
1428
1438
1429
1439
fake_request .assert_called_with (
1430
1440
'GET' ,
1431
- url_prefix + 'containers/3cc2351ab11b/export' ,
1441
+ (url_prefix + 'containers/' +
1442
+ fake_api .FAKE_CONTAINER_ID + '/export' ),
1432
1443
stream = True ,
1433
1444
timeout = DEFAULT_TIMEOUT_SECONDS
1434
1445
)
@@ -1438,7 +1449,8 @@ def test_export_with_dict_instead_of_id(self):
1438
1449
1439
1450
fake_request .assert_called_with (
1440
1451
'GET' ,
1441
- url_prefix + 'containers/3cc2351ab11b/export' ,
1452
+ (url_prefix + 'containers/' +
1453
+ fake_api .FAKE_CONTAINER_ID + '/export' ),
1442
1454
stream = True ,
1443
1455
timeout = DEFAULT_TIMEOUT_SECONDS
1444
1456
)
@@ -1448,7 +1460,7 @@ def test_inspect_container(self):
1448
1460
1449
1461
fake_request .assert_called_with (
1450
1462
'GET' ,
1451
- url_prefix + 'containers/3cc2351ab11b /json' ,
1463
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /json' ,
1452
1464
timeout = DEFAULT_TIMEOUT_SECONDS
1453
1465
)
1454
1466
@@ -1464,7 +1476,7 @@ def test_container_stats(self):
1464
1476
1465
1477
fake_request .assert_called_with (
1466
1478
'GET' ,
1467
- url_prefix + 'containers/3cc2351ab11b /stats' ,
1479
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /stats' ,
1468
1480
timeout = 60 ,
1469
1481
stream = True
1470
1482
)
@@ -1474,7 +1486,7 @@ def test_container_top(self):
1474
1486
1475
1487
fake_request .assert_called_with (
1476
1488
'GET' ,
1477
- url_prefix + 'containers/3cc2351ab11b /top' ,
1489
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /top' ,
1478
1490
params = {},
1479
1491
timeout = DEFAULT_TIMEOUT_SECONDS
1480
1492
)
@@ -1484,7 +1496,7 @@ def test_container_top_with_psargs(self):
1484
1496
1485
1497
fake_request .assert_called_with (
1486
1498
'GET' ,
1487
- url_prefix + 'containers/3cc2351ab11b /top' ,
1499
+ url_prefix + 'containers/' + fake_api . FAKE_CONTAINER_ID + ' /top' ,
1488
1500
params = {'ps_args' : 'waux' },
1489
1501
timeout = DEFAULT_TIMEOUT_SECONDS
1490
1502
)
@@ -1496,7 +1508,8 @@ def test_container_update(self):
1496
1508
blkio_weight = 345
1497
1509
)
1498
1510
args = fake_request .call_args
1499
- assert args [0 ][1 ] == url_prefix + 'containers/3cc2351ab11b/update'
1511
+ assert args [0 ][1 ] == (url_prefix + 'containers/' +
1512
+ fake_api .FAKE_CONTAINER_ID + '/update' )
1500
1513
assert json .loads (args [1 ]['data' ]) == {
1501
1514
'Memory' : 2 * 1024 , 'CpuShares' : 124 , 'BlkioWeight' : 345
1502
1515
}
0 commit comments