def test_docker_only(self): """Only Docker blob specified""" path = os.path.dirname(__file__) b = blob(docker=os.path.join(path, 'docker.blob')) self.assertEqual(b.toString(container_type.DOCKER), 'COPY foo bar\nRUN bar\n') self.assertEqual(b.toString(container_type.SINGULARITY), '')
def test_singularity_only_singularity(self): """Only Singularity blob specified""" path = os.path.dirname(__file__) b = blob(singularity=os.path.join(path, 'singularity.blob')) self.assertEqual(str(b), '''%files foo bar %post bar ''')
def test_all_singularity(self): """Both Docker and Singularity blobs specified""" path = os.path.dirname(__file__) b = blob(docker=os.path.join(path, 'docker.blob'), singularity=os.path.join(path, 'singularity.blob')) self.assertEqual(str(b), '''%files foo bar %post bar ''')
def test_singularity_only(self): """Only Singularity blob specified""" path = os.path.dirname(__file__) b = blob(singularity=os.path.join(path, 'singularity.blob')) self.assertEqual(b.toString(container_type.DOCKER), '') self.assertEqual(b.toString(container_type.SINGULARITY), '''%files foo bar %post bar ''')
def test_all(self): """Both Docker and Singularity blobs specified""" path = os.path.dirname(__file__) b = blob(docker=os.path.join(path, 'docker.blob'), singularity=os.path.join(path, 'singularity.blob')) self.assertEqual(b.toString(container_type.DOCKER), 'COPY foo bar\nRUN bar\n') self.assertEqual(b.toString(container_type.SINGULARITY), '''%files foo bar %post bar ''')
def test_all_docker(self): """Both Docker and Singularity blobs specified""" path = os.path.dirname(__file__) b = blob(docker=os.path.join(path, 'docker.blob'), singularity=os.path.join(path, 'singularity.blob')) self.assertEqual(str(b), 'COPY foo bar\nRUN bar\n')
def test_docker_only_singularity(self): """Only Docker blob specified""" path = os.path.dirname(__file__) b = blob(docker=os.path.join(path, 'docker.blob')) self.assertEqual(str(b), '')
def test_docker_only_docker(self): """Only Docker blob specified""" path = os.path.dirname(__file__) b = blob(docker=os.path.join(path, 'docker.blob')) self.assertEqual(str(b), 'COPY foo bar\nRUN bar\n')
def test_invalid_files(self): """Invalid file""" b = blob(docker='/path/to/nonexistent/file') self.assertEqual(str(b), '')
def test_invalid_ctype(self): """Invalid container type specified""" b = blob() with self.assertRaises(RuntimeError): str(b)
def test_empty(self): """No blob specified""" b = blob() self.assertEqual(str(b), '')
def test_invalid_files(self): """Invalid file""" b = blob(docker='/path/to/nonexistent/file') self.assertEqual(b.toString(container_type.DOCKER), '')
def test_invalid_ctype(self): """Invalid container type specified""" b = blob() self.assertEqual(b.toString(None), '')
def test_empty(self): """No blob specified""" b = blob() self.assertEqual(b.toString(container_type.DOCKER), '')