Move ServiceTestCase to separate module

This commit is contained in:
Ben Firshman 2013-12-09 17:36:44 +00:00
commit 4cf072a013
3 changed files with 33 additions and 31 deletions

30
plum/tests/testcases.py Normal file
View file

@ -0,0 +1,30 @@
from docker import Client
from plum.service import Service
import os
from unittest import TestCase
class ServiceTestCase(TestCase):
@classmethod
def setUpClass(cls):
if os.environ.get('DOCKER_URL'):
cls.client = Client(os.environ['DOCKER_URL'])
else:
cls.client = Client()
cls.client.pull('ubuntu')
def setUp(self):
for c in self.client.containers(all=True):
self.client.kill(c['Id'])
self.client.remove_container(c['Id'])
def create_service(self, name):
return Service(
name=name,
client=self.client,
image="ubuntu",
command=["/bin/sleep", "300"],
)