def test_main_with_exception(self): params = {'pathParameters': {'client_id': '123456789'}} responses.add(responses.GET, settings.AUTHLETE_CLIENT_ENDPOINT + '/get/' + params['pathParameters']['client_id'], json={"developer": "user01"}, status=200) response = ApplicationShow(params, {}).main() self.assertEqual(response['statusCode'], 500)
def test_main_ok_not_exists_description(self): params = {'pathParameters': {'client_id': '123456789'}} responses.add(responses.GET, settings.AUTHLETE_CLIENT_ENDPOINT + '/get/' + params['pathParameters']['client_id'], json={ 'clientName': 'client_name', 'hoge': 'hoge' }, status=200) response = ApplicationShow(params, {}).main() expected = {'clientName': 'client_name', 'description': None} self.assertEqual(200, response['statusCode']) self.assertEqual(expected, json.loads(response['body']))
def lambda_handler(event, context): applications_show = ApplicationShow(event=event, context=context) return applications_show.main()
def test_validation_client_id_invalid_type(self): params = {'pathParameters': {'client_id': 'AAA'}} response = ApplicationShow(params, {}).main() self.assertEqual(response['statusCode'], 400)
def test_validation_without_client_id(self): params = {'pathParameters': {}} response = ApplicationShow(params, {}).main() self.assertEqual(response['statusCode'], 400)