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
fb74311d
Kaydet (Commit)
fb74311d
authored
Kas 08, 2016
tarafından
Ben Firshman
Kaydeden (comit)
Joffrey F
Ara 08, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add random_name test helper
Signed-off-by:
Ben Firshman
<
ben@firshman.co.uk
>
üst
b7f7e4ea
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
helpers.py
tests/helpers.py
+5
-0
api_network_test.py
tests/integration/api_network_test.py
+3
-7
No files found.
tests/helpers.py
Dosyayı görüntüle @
fb74311d
import
os
import
os
import
os.path
import
os.path
import
random
import
tarfile
import
tarfile
import
tempfile
import
tempfile
import
time
import
time
...
@@ -56,3 +57,7 @@ def wait_on_condition(condition, delay=0.1, timeout=40):
...
@@ -56,3 +57,7 @@ def wait_on_condition(condition, delay=0.1, timeout=40):
if
time
.
time
()
-
start_time
>
timeout
:
if
time
.
time
()
-
start_time
>
timeout
:
raise
AssertionError
(
"Timeout:
%
s"
%
condition
)
raise
AssertionError
(
"Timeout:
%
s"
%
condition
)
time
.
sleep
(
delay
)
time
.
sleep
(
delay
)
def
random_name
():
return
u'dockerpytest_{0:x}'
.
format
(
random
.
getrandbits
(
64
))
tests/integration/api_network_test.py
Dosyayı görüntüle @
fb74311d
import
random
import
docker
import
docker
from
docker.utils
import
create_ipam_config
from
docker.utils
import
create_ipam_config
from
docker.utils
import
create_ipam_pool
from
docker.utils
import
create_ipam_pool
import
pytest
import
pytest
from
..helpers
import
requires_api_version
from
..helpers
import
r
andom_name
,
r
equires_api_version
from
.base
import
BaseAPIIntegrationTest
from
.base
import
BaseAPIIntegrationTest
class
TestNetworks
(
BaseAPIIntegrationTest
):
class
TestNetworks
(
BaseAPIIntegrationTest
):
def
create_network
(
self
,
*
args
,
**
kwargs
):
def
create_network
(
self
,
*
args
,
**
kwargs
):
net_name
=
u'dockerpy{}'
.
format
(
random
.
getrandbits
(
24
))[:
14
]
net_name
=
random_name
()
net_id
=
self
.
client
.
create_network
(
net_name
,
*
args
,
**
kwargs
)[
'Id'
]
net_id
=
self
.
client
.
create_network
(
net_name
,
*
args
,
**
kwargs
)[
'Id'
]
self
.
tmp_networks
.
append
(
net_id
)
self
.
tmp_networks
.
append
(
net_id
)
return
(
net_name
,
net_id
)
return
(
net_name
,
net_id
)
...
@@ -84,10 +82,8 @@ class TestNetworks(BaseAPIIntegrationTest):
...
@@ -84,10 +82,8 @@ class TestNetworks(BaseAPIIntegrationTest):
@requires_api_version
(
'1.21'
)
@requires_api_version
(
'1.21'
)
def
test_create_network_with_host_driver_fails
(
self
):
def
test_create_network_with_host_driver_fails
(
self
):
net_name
=
'dockerpy{}'
.
format
(
random
.
getrandbits
(
24
))[:
14
]
with
pytest
.
raises
(
docker
.
errors
.
APIError
):
with
pytest
.
raises
(
docker
.
errors
.
APIError
):
self
.
client
.
create_network
(
net_name
,
driver
=
'host'
)
self
.
client
.
create_network
(
random_name
()
,
driver
=
'host'
)
@requires_api_version
(
'1.21'
)
@requires_api_version
(
'1.21'
)
def
test_remove_network
(
self
):
def
test_remove_network
(
self
):
...
...
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