<s> import unittest <EOL> import json <EOL> import sys <EOL> import os <EOL> import requests <EOL> PATH = os . path . dirname ( os . path . realpath ( __file__ ) ) <EOL> sys . path . append ( os . path . join ( os . path . join ( os . path . join ( PATH , '<STR_LIT:..>' ) , '<STR_LIT:..>' ) , '<STR_LIT>' ) ) <EOL> import opsmgr <EOL> class VerifyApp3 ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . cfinfo = opsmgr . get_cfinfo ( ) <EOL> self . hostname = '<STR_LIT>' + self . cfinfo [ '<STR_LIT>' ] <EOL> self . url = '<STR_LIT>' + self . hostname <EOL> def test_responds_to_hello ( self ) : <EOL> headers = { '<STR_LIT>' : '<STR_LIT:application/json>' } <EOL> response = requests . get ( self . url + '<STR_LIT>' , headers = headers ) <EOL> response . raise_for_status ( ) <EOL> def test_receives_custom_properties ( self ) : <EOL> headers = { '<STR_LIT>' : '<STR_LIT:application/json>' } <EOL> response = requests . get ( self . url + '<STR_LIT>' , headers = headers ) <EOL> response . raise_for_status ( ) <EOL> env = response . json ( ) <EOL> self . assertEqual ( env . get ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> self . assertEqual ( env . get ( '<STR_LIT>' ) , "<STR_LIT>" ) <EOL> self . assertEqual ( env . get ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> self . assertEqual ( env . get ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> self . assertEqual ( env . get ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> self . assertEqual ( env . get ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> def test_receives_expected_services ( self ) : <EOL> headers = { '<STR_LIT>' : '<STR_LIT:application/json>' } <EOL> response = requests . get ( self . url + '<STR_LIT>' , headers = headers ) <EOL> response . raise_for_status ( ) <EOL> env = response . json ( ) <EOL> vcap_services = json . loads ( env . get ( '<STR_LIT>' ) ) <EOL> broker1_service = vcap_services . get ( '<STR_LIT>' , None ) <EOL> self . assertTrue ( broker1_service is not None ) <EOL> self . assertEquals ( len ( broker1_service ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( broker1_service [ <NUM_LIT:0> ] . get ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> def test_has_versioned_name ( self ) : <EOL> headers = { '<STR_LIT>' : '<STR_LIT:application/json>' } <EOL> response = requests . get ( self . url + '<STR_LIT>' , headers = headers ) <EOL> response . raise_for_status ( ) <EOL> env = response . json ( ) <EOL> vcap_application = json . loads ( env . get ( '<STR_LIT>' ) ) <EOL> name = vcap_application . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( name . startswith ( '<STR_LIT>' ) ) <EOL> def test_is_in_correct_space ( self ) : <EOL> headers = { '<STR_LIT>' : '<STR_LIT:application/json>' } <EOL> response = requests . get ( self . url + '<STR_LIT>' , headers = headers ) <EOL> response . raise_for_status ( ) <EOL> env = response . json ( ) <EOL> vcap_application = json . loads ( env . get ( '<STR_LIT>' ) ) <EOL> space = vcap_application . get ( '<STR_LIT>' ) <EOL> self . assertEquals ( space , '<STR_LIT>' ) <EOL> def test_does_not_receive_admin_credentials ( self ) : <EOL> headers = { '<STR_LIT>' : '<STR_LIT:application/json>' } <EOL> response = requests . get ( self . url + '<STR_LIT>' , headers = headers ) <EOL> response . raise_for_status ( ) <EOL> env = response . json ( ) <EOL> user = env . get ( '<STR_LIT>' ) <EOL> username = env . get ( '<STR_LIT>' ) <EOL> password = env . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( user is None ) <EOL> self . assertTrue ( username is None ) <EOL> self . assertTrue ( password is None ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
