def get_test_artifact(uri, ptype): # chunk.ProductType.SCIENCE is a common type if ptype is None: ptype = chunk.ProductType.SCIENCE test_artifact = artifact.Artifact(uri, ptype, artifact.ReleaseType.DATA) chunks = TypedList(chunk.Chunk) chunks.append(ArtifactTestUtil.get_good_test_chunk(ptype)) pname = "test_part" test_part = PartTestUtil.get_test_part(pname, ptype) test_artifact.parts = TypedOrderedDict(part.Part) test_artifact.parts[pname] = test_part return test_artifact
def get_test_artifact(ptype): # chunk.ProductType.SCIENCE is a common type if ptype is None: ptype = chunk.ProductType.SCIENCE test_artifact = artifact.Artifact('uri:foo/bar', ptype, artifact.ReleaseType.DATA) chunks = TypedList(chunk.Chunk) chunks.append(ArtifactTestUtil.get_good_test_chunk(ptype)) test_part = part.Part("test_part", ptype, chunks) test_artifact.parts = TypedOrderedDict(part.Part) test_artifact.parts['test_part'] = test_part return test_artifact
def get_artifacts(self): artifacts = collections.OrderedDict() _artifact = artifact.Artifact("ad:foo/bar1", chunk.ProductType.SCIENCE, artifact.ReleaseType.META) if self.complete: _artifact.content_type = "application/fits" _artifact.content_length = int(12345) _artifact.last_modified = common.get_current_ivoa_time() if self.caom_version >= 23: _artifact.max_last_modified = common.get_current_ivoa_time() _artifact.meta_checksum = common.ChecksumURI("md5:9882dbbf9cadc221019b712fd402bcbd") _artifact.acc_meta_checksum = common.ChecksumURI("md5:844ce247db0844ad9f721430c80e7a21") if self.depth > 3: for k, v in six.iteritems(self.get_parts()): _artifact.parts[k] = v artifacts["ad:foo/bar1"] = _artifact return artifacts