<s> """<STR_LIT>""" <EOL> from django . core . urlresolvers import reverse <EOL> from django . core . files . uploadedfile import SimpleUploadedFile <EOL> from rest_framework import status <EOL> from rest_framework . test import APITestCase <EOL> from omaha . factories import ApplicationFactory , ChannelFactory <EOL> from sparkle . serializers import SparkleVersionSerializer <EOL> from sparkle . factories import SparkleVersionFactory <EOL> from sparkle . models import SparkleVersion <EOL> from omaha . tests . utils import temporary_media_root <EOL> from omaha . tests . test_api import BaseTest <EOL> from omaha_server . utils import is_private <EOL> class VersionTest ( BaseTest , APITestCase ) : <EOL> url = '<STR_LIT>' <EOL> url_detail = '<STR_LIT>' <EOL> factory = SparkleVersionFactory <EOL> serializer = SparkleVersionSerializer <EOL> @ is_private ( ) <EOL> @ temporary_media_root ( MEDIA_URL = '<STR_LIT>' ) <EOL> def test_detail ( self ) : <EOL> super ( VersionTest , self ) . test_detail ( ) <EOL> @ is_private ( ) <EOL> @ temporary_media_root ( MEDIA_URL = '<STR_LIT>' ) <EOL> def test_list ( self ) : <EOL> super ( VersionTest , self ) . test_list ( ) <EOL> @ is_private ( ) <EOL> @ temporary_media_root ( MEDIA_URL = '<STR_LIT>' ) <EOL> def test_create ( self ) : <EOL> data = dict ( <EOL> app = ApplicationFactory . create ( ) . id , <EOL> channel = ChannelFactory . create ( ) . id , <EOL> version = '<STR_LIT>' , <EOL> file = SimpleUploadedFile ( "<STR_LIT>" , b'<STR_LIT:content>' ) , <EOL> ) <EOL> response = self . client . post ( reverse ( self . url ) , data ) <EOL> self . assertEqual ( response . status_code , status . HTTP_201_CREATED ) <EOL> version = SparkleVersion . objects . get ( id = response . data [ '<STR_LIT:id>' ] ) <EOL> self . assertEqual ( response . data , self . serializer ( version ) . data ) <EOL> self . assertEqual ( version . file_size , len ( b'<STR_LIT:content>' ) ) <EOL> self . assertTrue ( version . is_enabled ) </s>
