<s> from django . db import models <EOL> from django . test import TestCase <EOL> from django_fsm import FSMField , transition <EOL> from django_fsm . signals import post_transition <EOL> class TestModel ( models . Model ) : <EOL> counter = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> signal_counter = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> state = FSMField ( default = "<STR_LIT>" ) <EOL> @ transition ( field = state , source = "<STR_LIT>" , target = "<STR_LIT>" ) <EOL> @ transition ( field = state , source = "<STR_LIT>" , target = "<STR_LIT>" ) <EOL> @ transition ( field = state , source = "<STR_LIT>" , target = "<STR_LIT>" ) <EOL> def review ( self ) : <EOL> self . counter += <NUM_LIT:1> <EOL> class Meta : <EOL> app_label = '<STR_LIT>' <EOL> def count_calls ( sender , instance , name , source , target , ** kwargs ) : <EOL> instance . signal_counter += <NUM_LIT:1> <EOL> post_transition . connect ( count_calls , sender = TestModel ) <EOL> class TestStateProxy ( TestCase ) : <EOL> def test_transition_method_called_once ( self ) : <EOL> model = TestModel ( ) <EOL> model . review ( ) <EOL> self . assertEqual ( <NUM_LIT:1> , model . counter ) <EOL> self . assertEqual ( <NUM_LIT:1> , model . signal_counter ) </s>
