Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
docker-py
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
docker-py
Commits
1ec551cb
Kaydet (Commit)
1ec551cb
authored
Haz 21, 2014
tarafından
d11wtq
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add resize() method to Client
üst
a8e03d32
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
0 deletions
+33
-0
client.py
docker/client.py
+9
-0
fake_api.py
tests/fake_api.py
+8
-0
test.py
tests/test.py
+16
-0
No files found.
docker/client.py
Dosyayı görüntüle @
1ec551cb
...
...
@@ -811,6 +811,15 @@ class Client(requests.Session):
res
=
self
.
_post_json
(
url
,
data
=
start_config
)
self
.
_raise_for_status
(
res
)
def
resize
(
self
,
container
,
height
,
width
):
if
isinstance
(
container
,
dict
):
container
=
container
.
get
(
'Id'
)
params
=
{
'h'
:
height
,
'w'
:
width
}
url
=
self
.
_url
(
"/containers/{0}/resize"
.
format
(
container
))
res
=
self
.
_post
(
url
,
params
=
params
)
self
.
_raise_for_status
(
res
)
def
stop
(
self
,
container
,
timeout
=
10
):
if
isinstance
(
container
,
dict
):
container
=
container
.
get
(
'Id'
)
...
...
tests/fake_api.py
Dosyayı görüntüle @
1ec551cb
...
...
@@ -103,6 +103,12 @@ def post_fake_start_container():
return
status_code
,
response
def
post_fake_resize_container
():
status_code
=
200
response
=
{
'Id'
:
FAKE_CONTAINER_ID
}
return
status_code
,
response
def
post_fake_create_container
():
status_code
=
200
response
=
{
'Id'
:
FAKE_CONTAINER_ID
}
...
...
@@ -310,6 +316,8 @@ fake_responses = {
get_fake_containers
,
'{1}/{0}/containers/3cc2351ab11b/start'
.
format
(
CURRENT_VERSION
,
prefix
):
post_fake_start_container
,
'{1}/{0}/containers/3cc2351ab11b/resize'
.
format
(
CURRENT_VERSION
,
prefix
):
post_fake_resize_container
,
'{1}/{0}/containers/3cc2351ab11b/json'
.
format
(
CURRENT_VERSION
,
prefix
):
get_fake_inspect_container
,
'{1}/{0}/images/e9aa60c60128/tag'
.
format
(
CURRENT_VERSION
,
prefix
):
...
...
tests/test.py
Dosyayı görüntüle @
1ec551cb
...
...
@@ -690,6 +690,22 @@ class DockerClientTest(unittest.TestCase):
docker
.
client
.
DEFAULT_TIMEOUT_SECONDS
)
def
test_resize_container
(
self
):
try
:
self
.
client
.
resize
(
{
'Id'
:
fake_api
.
FAKE_CONTAINER_ID
},
height
=
15
,
width
=
120
)
except
Exception
as
e
:
self
.
fail
(
'Command should not raise exception: {0}'
.
format
(
e
))
fake_request
.
assert_called_with
(
url_prefix
+
'containers/3cc2351ab11b/resize'
,
params
=
{
'h'
:
15
,
'w'
:
120
},
timeout
=
docker
.
client
.
DEFAULT_TIMEOUT_SECONDS
)
def
test_wait
(
self
):
try
:
self
.
client
.
wait
(
fake_api
.
FAKE_CONTAINER_ID
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment