def test_provided_schema_not_swagger_file(self, mock_server): assert main.setup_client( URL, { 'hello': 'world', }, ) == 'Invalid swagger format.'
def mock_client(mock_schema): fuzz_lightyear.victim_account( lambda: { '_request_options': { 'headers': { 'Cookie': 'session=victim_session', }, }, }, ) fuzz_lightyear.attacker_account( lambda: { '_request_options': { 'headers': { 'Cookie': 'session=attacker_session', }, }, }, ) setup_client(mock_server_module.URL, mock_schema) yield get_abstraction().client
def test_success_with_provided_schema(self, mock_server, mock_schema): assert not main.setup_client(URL, mock_schema)
def test_success_with_url_only(self, mock_server): assert not main.setup_client('{}/schema'.format(URL))
def test_invalid_schema_at_url(self, mock_server): assert 'Invalid swagger file.' in main.setup_client(URL)
def test_unable_to_connect_to_url(self, mock_server): url = 'http://localhost:{}'.format(PORT + 1) assert main.setup_client(url) == 'Unable to connect to server.'