def test_exec_dockerps(self, *args): for c in dockerutils.exec_dockerps(): print c break docker_datetime = dp.parse('2016-07-06') epoch_seconds = docker_datetime.strftime('%s') assert c == {'Name': '/pensive_rosalind', 'Created': epoch_seconds, 'RepoTag': 'r', 'State': {'Status': 'running', 'Running': True, 'Pid': '11186'}, 'Mounts': [], 'Config': {'Image': 'ubuntu:trusty', 'Cmd': ['bash']}, 'NetworkSettings': {'Ports': { '80/tcp': [{'HostPort': '32768', 'HostIp': '0.0.0.0'}]}}, 'Image': 'sha256:07c86167cdc4264926fa5d2894e34a339ad27', 'LogPath': '/a/b/c/log.json', 'HostConfig': {'PortBindings': { '809/tcp': [{'HostPort': '', 'HostIp': ''}]}}, 'Id': 'good_id'}
def test_dockerps(long_id): found = False for inspect in exec_dockerps(): c_long_id = inspect['Id'] if long_id == c_long_id: found = True print sys._getframe().f_code.co_name, int(found)
def test_dockerps(self): for inspect in exec_dockerps(): c_long_id = inspect['Id'] break # there should only be one container anyway assert self.container['Id'] == c_long_id
def test_exec_dockerps_failure(self, *args): with self.assertRaises(DockerutilsException): dockerutils.exec_dockerps()