Esempio n. 1
0
File: tests.py Progetto: crs4/ACTIVE
def create_item(user_id=1):        
    """
    Method used to create and return a simple ImageItem object.
    """     
    item = ImageItem()
    item.filename = "sample.mp4"
    item.owner = User.objects.get(pk=user_id)
    item.save()
    return item
Esempio n. 2
0
 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 ImageItem
     item = ImageItem()
     item.filename = ''
     item.type = 'image'
     item.file = File(os.path.join(settings.MEDIA_ROOT, 'tests', 'test_image', 'test.jpg'))
     item.owner = user
     item.save()