Пример #1
0
    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)
Пример #2
0
    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']))
Пример #3
0
def lambda_handler(event, context):
    applications_show = ApplicationShow(event=event, context=context)
    return applications_show.main()
Пример #4
0
    def test_validation_client_id_invalid_type(self):
        params = {'pathParameters': {'client_id': 'AAA'}}

        response = ApplicationShow(params, {}).main()
        self.assertEqual(response['statusCode'], 400)
Пример #5
0
    def test_validation_without_client_id(self):
        params = {'pathParameters': {}}

        response = ApplicationShow(params, {}).main()
        self.assertEqual(response['statusCode'], 400)