#NEWLINE# def test_invalid_serializer( self ) : #NEWLINE# #INDENT# now = timezone . now ( ) #NEWLINE# serializer = SubscriptionSerializer ( data = { #NEWLINE# #INDENT# 'plan' : settings . DJSTRIPE_PLANS [ 'test0' ] [ 'plan' ] , #NEWLINE# 'start' : now , #NEWLINE# 'status' : CurrentSubscription . STATUS_ACTIVE , #NEWLINE# 'amount' : settings . DJSTRIPE_PLANS [ 'test0' ] [ 'price' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertFalse ( serializer . is_valid ( ) ) #NEWLINE# self . assertEqual ( serializer . validated_data , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( serializer . errors , { #NEWLINE# #INDENT# 'quantity' : [ 'This field is required.' ] , #NEWLINE# #UNINDENT# } )