<s> import json <EOL> import time <EOL> import requests <EOL> from functionaltests . api import base <EOL> from functionaltests . api . common import apputils <EOL> class TestTriggerController ( base . TestCase ) : <EOL> def test_trigger_post ( self ) : <EOL> lp_name = self . client . create_lp ( ) <EOL> data = apputils . get_sample_data ( languagepack = lp_name ) <EOL> resp = self . client . create_app ( data = data ) <EOL> bdy = json . loads ( resp . body ) <EOL> trigger_uri = bdy [ '<STR_LIT>' ] <EOL> status_url = '<STR_LIT>' <EOL> body_dict = { '<STR_LIT>' : { '<STR_LIT:url>' : '<STR_LIT>' } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : { '<STR_LIT>' : '<STR_LIT>' } } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : status_url } } <EOL> body = json . dumps ( body_dict ) <EOL> resp = requests . post ( trigger_uri , data = body ) <EOL> self . assertEqual ( resp . status_code , <NUM_LIT> ) <EOL> self . client . delete_created_apps ( ) <EOL> time . sleep ( <NUM_LIT:2> ) <EOL> self . client . delete_created_lps ( ) <EOL> def test_trigger_post_with_empty_body ( self ) : <EOL> lp_name = self . client . create_lp ( ) <EOL> data = apputils . get_sample_data ( languagepack = lp_name ) <EOL> resp = self . client . create_app ( data = data ) <EOL> bdy = json . loads ( resp . body ) <EOL> trigger_uri = bdy [ '<STR_LIT>' ] <EOL> resp = requests . post ( trigger_uri ) <EOL> self . assertEqual ( resp . status_code , <NUM_LIT> ) <EOL> self . client . delete_created_apps ( ) <EOL> time . sleep ( <NUM_LIT:2> ) <EOL> self . client . delete_created_lps ( ) </s>
