<s> from changes . config import db <EOL> from changes . models import ItemOption , Step <EOL> from changes . testutils import APITestCase <EOL> class StepDetailsTest ( APITestCase ) : <EOL> def test_simple ( self ) : <EOL> project = self . create_project ( ) <EOL> plan = self . create_plan ( project , label = '<STR_LIT>' ) <EOL> step = self . create_step ( plan = plan ) <EOL> self . create_option ( item_id = step . id , name = '<STR_LIT>' , value = '<STR_LIT:1>' ) <EOL> path = '<STR_LIT>' . format ( step . id . hex ) <EOL> resp = self . client . get ( path ) <EOL> assert resp . status_code == <NUM_LIT:200> <EOL> data = self . unserialize ( resp ) <EOL> assert data [ '<STR_LIT:id>' ] == step . id . hex <EOL> assert data [ '<STR_LIT>' ] == { '<STR_LIT>' : '<STR_LIT:1>' } <EOL> class UpdateStepDetailsTest ( APITestCase ) : <EOL> def test_requires_auth ( self ) : <EOL> project = self . create_project ( ) <EOL> plan = self . create_plan ( project , label = '<STR_LIT>' ) <EOL> step = self . create_step ( plan = plan ) <EOL> path = '<STR_LIT>' . format ( step . id . hex ) <EOL> resp = self . client . post ( path ) <EOL> assert resp . status_code == <NUM_LIT> <EOL> def test_simple ( self ) : <EOL> self . login_default_admin ( ) <EOL> project = self . create_project ( ) <EOL> plan = self . create_plan ( project , label = '<STR_LIT>' ) <EOL> step = self . create_step ( plan = plan ) <EOL> self . login_default_admin ( ) <EOL> path = '<STR_LIT>' . format ( step . id . hex ) <EOL> resp = self . client . post ( path , data = { <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:data>' : '<STR_LIT:{}>' , <EOL> '<STR_LIT>' : '<STR_LIT:1>' , <EOL> } ) <EOL> assert resp . status_code == <NUM_LIT:200> <EOL> data = self . unserialize ( resp ) <EOL> assert data [ '<STR_LIT:data>' ] == '<STR_LIT:{}>' <EOL> assert data [ '<STR_LIT>' ] == <NUM_LIT:1> <EOL> assert data [ '<STR_LIT>' ] == '<STR_LIT>' <EOL> assert data [ '<STR_LIT>' ] == { '<STR_LIT>' : '<STR_LIT:1>' } <EOL> db . session . expire ( step ) <EOL> step = Step . query . get ( step . id ) <EOL> assert step . data == { } <EOL> assert step . order == <NUM_LIT:1> <EOL> assert step . implementation == '<STR_LIT>' <EOL> options = list ( ItemOption . query . filter ( ItemOption . item_id == step . id ) ) <EOL> assert len ( options ) == <NUM_LIT:1> <EOL> assert options [ <NUM_LIT:0> ] . name == '<STR_LIT>' <EOL> assert options [ <NUM_LIT:0> ] . value == '<STR_LIT:1>' <EOL> class DeleteStepDetailsTest ( APITestCase ) : <EOL> def test_requires_auth ( self ) : <EOL> project = self . create_project ( ) <EOL> plan = self . create_plan ( project , label = '<STR_LIT>' ) <EOL> step = self . create_step ( plan = plan ) <EOL> path = '<STR_LIT>' . format ( step . id . hex ) <EOL> resp = self . client . delete ( path ) <EOL> assert resp . status_code == <NUM_LIT> <EOL> def test_simple ( self ) : <EOL> self . login_default ( ) <EOL> project = self . create_project ( ) <EOL> plan = self . create_plan ( project , label = '<STR_LIT>' ) <EOL> step = self . create_step ( plan = plan ) <EOL> self . login_default_admin ( ) <EOL> path = '<STR_LIT>' . format ( step . id . hex ) <EOL> step_id = step . id <EOL> resp = self . client . delete ( path ) <EOL> assert resp . status_code == <NUM_LIT:200> <EOL> db . session . expire_all ( ) <EOL> step = Step . query . get ( step_id ) <EOL> assert step is None </s>
