<s> from changes . config import db <EOL> from changes . models import ItemOption <EOL> from changes . testutils import APITestCase <EOL> class PlanOptionsListTest ( APITestCase ) : <EOL> def test_simple ( self ) : <EOL> project = self . create_project ( ) <EOL> plan = self . create_plan ( project ) <EOL> path = '<STR_LIT>' . format ( plan . 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>' ] == '<STR_LIT:0>' <EOL> db . session . add ( ItemOption ( <EOL> name = '<STR_LIT>' , <EOL> value = '<STR_LIT:1>' , <EOL> item_id = plan . id , <EOL> ) ) <EOL> db . session . commit ( ) <EOL> resp = self . client . get ( path ) <EOL> assert resp . status_code == <NUM_LIT:200> <EOL> data = self . unserialize ( resp ) <EOL> assert data [ '<STR_LIT>' ] == '<STR_LIT:1>' <EOL> class PlanOptionsUpdateTest ( APITestCase ) : <EOL> def test_simple ( self ) : <EOL> project = self . create_project ( ) <EOL> plan = self . create_plan ( project ) <EOL> path = '<STR_LIT>' . format ( plan . id . hex ) <EOL> resp = self . client . post ( path , data = { <EOL> '<STR_LIT>' : '<STR_LIT:1>' , <EOL> } ) <EOL> assert resp . status_code == <NUM_LIT> <EOL> self . login_default ( ) <EOL> resp = self . client . post ( path , data = { <EOL> '<STR_LIT>' : '<STR_LIT:1>' , <EOL> } ) <EOL> assert resp . status_code == <NUM_LIT> <EOL> self . login_default_admin ( ) <EOL> resp = self . client . post ( path , data = { <EOL> '<STR_LIT>' : '<STR_LIT:1>' , <EOL> } ) <EOL> assert resp . status_code == <NUM_LIT:200> <EOL> options = dict ( db . session . query ( <EOL> ItemOption . name , ItemOption . value <EOL> ) . filter ( <EOL> ItemOption . item_id == plan . id , <EOL> ) ) <EOL> assert options . get ( '<STR_LIT>' ) == '<STR_LIT:1>' </s>
