def create_item(user_id=1): """ Method used to create and return a simple VideoItem object. """ item = VideoItem() item.filename = "sample.mp4" item.owner = User.objects.get(pk=user_id) item.save() return item
def setUp(self): """ Method used to setup the test database """ # create a new user user = User.objects.create_user('root', '*****@*****.**', 'root') user.is_superuser = True user.save() token = Token.objects.create(user=user) # create a new VideoItem item = VideoItem() item.filename = '' item.type = 'video' item.file = File(os.path.join(settings.MEDIA_ROOT, 'tests', 'test_video', 'test.mp4')) item.owner = user item.save()