def setUp(self) -> None: self.user = User.objects.create_superuser("batch_import_user", "*****@*****.**", uuid4) self.root_node = Node.add_root(name="test") self.collection = Collection.objects.create(name="test", short_name="test", root_node=self.root_node) self.collection.administrators.set([self.user])
def generate_test_media(): creator, _ = MediaCreator.objects.get_or_create(first_name="Tester", last_name="Testeroo") user, _ = User.objects.get_or_create(username="******", email="*****@*****.**") license, _ = License.objects.get_or_create(short_name="WTFPL") media_type, _ = MediaType.objects.get_or_create(type=1, name="testtype") node = Node.add_root(name="TestingCollection") return Media.objects.create_media( created_by=user, license=license, creation_date=( timezone.now() - timedelta(days=3), timezone.now() - timedelta(hours=2), ), set=node, creators=[creator], original_media_type=media_type, )
def setUp(self): self.root = Node.add_root(name="testroot") self.target = self.root.add_child(name="testchild") self.user = User.objects.create_superuser("tester", "*****@*****.**", uuid4()) self.creator = MediaCreator.objects.create(first_name="Tester", last_name="Testeroo") self.role = MediaCreatorRole.objects.create(name="testrole") self.license = License.objects.create(short_name="WTFPL") self.collection = Collection.objects.create(name="Testcollection", root_node=self.target) self.media_type = MediaType.objects.create(type=1, name="testtype") self.collection.administrators.set([self.user]) self.tag = Tag.objects.create(name="testtag", collection=self.collection) self.source_id = self.generate_source_id() self.queue = IngestQueue.objects.create( target=self.target, created_by=self.user, ingestion_queue=[self.source_id]) self.url = reverse("api:v1:ingest:ingest_queue_ingest", kwargs={"pk": str(self.queue.pk)})