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
b5f7d380
Unverified
Kaydet (Commit)
b5f7d380
authored
Eki 21, 2016
tarafından
Ben Firshman
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add helpful error for APIClient methods on Client
Signed-off-by:
Ben Firshman
<
ben@firshman.co.uk
>
üst
c7a3aa7e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
client.py
docker/client.py
+10
-0
client_test.py
tests/unit/client_test.py
+14
-0
No files found.
docker/client.py
Dosyayı görüntüle @
b5f7d380
...
@@ -154,4 +154,14 @@ class Client(object):
...
@@ -154,4 +154,14 @@ class Client(object):
return
self
.
api
.
version
(
*
args
,
**
kwargs
)
return
self
.
api
.
version
(
*
args
,
**
kwargs
)
version
.
__doc__
=
APIClient
.
version
.
__doc__
version
.
__doc__
=
APIClient
.
version
.
__doc__
def
__getattr__
(
self
,
name
):
s
=
[
"'Client' object has no attribute '{}'"
.
format
(
name
)]
# If a user calls a method on APIClient, they
if
hasattr
(
APIClient
,
name
):
s
.
append
(
"In docker-py 2.0, this method is now on the object "
"APIClient. See the low-level API section of the "
"documentation for more details."
.
format
(
name
))
raise
AttributeError
(
' '
.
join
(
s
))
from_env
=
Client
.
from_env
from_env
=
Client
.
from_env
tests/unit/client_test.py
Dosyayı görüntüle @
b5f7d380
...
@@ -45,6 +45,20 @@ class ClientTest(unittest.TestCase):
...
@@ -45,6 +45,20 @@ class ClientTest(unittest.TestCase):
assert
client
.
version
()
==
mock_func
.
return_value
assert
client
.
version
()
==
mock_func
.
return_value
mock_func
.
assert_called_with
()
mock_func
.
assert_called_with
()
def
test_call_api_client_method
(
self
):
client
=
docker
.
from_env
()
with
self
.
assertRaises
(
AttributeError
)
as
cm
:
client
.
create_container
()
s
=
str
(
cm
.
exception
)
assert
"'Client' object has no attribute 'create_container'"
in
s
assert
"this method is now on the object APIClient"
in
s
with
self
.
assertRaises
(
AttributeError
)
as
cm
:
client
.
abcdef
()
s
=
str
(
cm
.
exception
)
assert
"'Client' object has no attribute 'abcdef'"
in
s
assert
"this method is now on the object APIClient"
not
in
s
class
FromEnvTest
(
unittest
.
TestCase
):
class
FromEnvTest
(
unittest
.
TestCase
):
...
...
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