Exemplo n.º 1
0
    def list(self, request):

        ''' List all custom URLs for target Projects or Users. '''

        urls = CustomURL.query().fetch()
        messages = []
        for url in urls:
            messages.append(url.to_message())
        return CustomUrlsMessage(urls=messages)
Exemplo n.º 2
0
    def test_custom_url_delete_method(self):

        ''' Add a custom_url and then delete it through the api. '''

        slug = 'test-slug'
        custom_url_key = db_loader.create_custom_url(slug=slug)
        params = {
            'key': encrypt(custom_url_key.urlsafe()),
        }
        response = generic_service_method_success_test(self, 'url', 'delete', params=params)
        self.assertEqual(response['response']['type'], 'Echo',
            'CustomUrl delete service method failed.')
        self.assertEqual(len(CustomURL.query().fetch(1)), 0, 'Failed to delete custom url.')