summaryrefslogtreecommitdiff
path: root/tests/integration/api_swarm_test.py
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2017-11-07 15:29:53 -0800
committerJoffrey F <joffrey@docker.com>2017-11-07 15:44:54 -0800
commit3bd053a4b703156e5e1f66e3e1b4c72beada2b33 (patch)
tree2ab18f79d16e962fbfd29e7b7edc05fe6fc5ff67 /tests/integration/api_swarm_test.py
parentaa3c4f026d435af98391568c30998414fe2baedf (diff)
downloaddocker-py-unlock_swarm_support.tar.gz
Add unlock methods to Swarm modelunlock_swarm_support
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'tests/integration/api_swarm_test.py')
-rw-r--r--tests/integration/api_swarm_test.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/integration/api_swarm_test.py b/tests/integration/api_swarm_test.py
index 1a945c5..56b0129 100644
--- a/tests/integration/api_swarm_test.py
+++ b/tests/integration/api_swarm_test.py
@@ -10,13 +10,13 @@ class SwarmTest(BaseAPIIntegrationTest):
def setUp(self):
super(SwarmTest, self).setUp()
force_leave_swarm(self.client)
+ self._unlock_key = None
def tearDown(self):
super(SwarmTest, self).tearDown()
try:
- unlock_key = self.client.get_unlock_key()
- if unlock_key.get('UnlockKey'):
- self.unlock_swarm(unlock_key)
+ if self._unlock_key:
+ self.client.unlock_swarm(self._unlock_key)
except docker.errors.APIError:
pass
@@ -71,14 +71,15 @@ class SwarmTest(BaseAPIIntegrationTest):
def test_init_swarm_with_autolock_managers(self):
spec = self.client.create_swarm_spec(autolock_managers=True)
assert self.init_swarm(swarm_spec=spec)
+ # save unlock key for tearDown
+ self._unlock_key = self.client.get_unlock_key()
swarm_info = self.client.inspect_swarm()
assert (
swarm_info['Spec']['EncryptionConfig']['AutoLockManagers'] is True
)
- unlock_key = self.get_unlock_key()
- assert unlock_key.get('UnlockKey')
+ assert self._unlock_key.get('UnlockKey')
@requires_api_version('1.25')
@pytest.mark.xfail(