How to use the pdpyras.tokenize_url_path function in pdpyras

To help you get started, we’ve selected a few pdpyras examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PagerDuty / pdpyras / test_pdpyras.py View on Github external
def test_tokenize_url_path(self):
        cm_path = ('users', '{id}', 'contact_methods', '{index}')
        cm_path_str = 'users/PABC123/contact_methods'
        baseurl = 'https://rest.pd/'
        self.assertEqual(cm_path, pdpyras.tokenize_url_path(cm_path_str))
        self.assertEqual(cm_path, pdpyras.tokenize_url_path(baseurl+cm_path_str,
            baseurl=baseurl))
        self.assertRaises(ValueError, pdpyras.tokenize_url_path,
            '/https://api.pagerduty.com/?')
        self.assertRaises(ValueError, pdpyras.tokenize_url_path,
            'https://api.pagerduty.com/')
        self.assertRaises(ValueError, pdpyras.tokenize_url_path,
            'https://api.pagerduty.com')
        self.assertRaises(ValueError, pdpyras.tokenize_url_path,
            '/')
        self.assertRaises(ValueError, pdpyras.tokenize_url_path,
            '/users/')
        self.assertEqual(('users','{index}'),
            pdpyras.tokenize_url_path('/users'))
github PagerDuty / pdpyras / test_pdpyras.py View on Github external
def test_tokenize_url_path(self):
        cm_path = ('users', '{id}', 'contact_methods', '{index}')
        cm_path_str = 'users/PABC123/contact_methods'
        baseurl = 'https://rest.pd/'
        self.assertEqual(cm_path, pdpyras.tokenize_url_path(cm_path_str))
        self.assertEqual(cm_path, pdpyras.tokenize_url_path(baseurl+cm_path_str,
            baseurl=baseurl))
        self.assertRaises(ValueError, pdpyras.tokenize_url_path,
            '/https://api.pagerduty.com/?')
        self.assertRaises(ValueError, pdpyras.tokenize_url_path,
            'https://api.pagerduty.com/')
        self.assertRaises(ValueError, pdpyras.tokenize_url_path,
            'https://api.pagerduty.com')
        self.assertRaises(ValueError, pdpyras.tokenize_url_path,
            '/')
        self.assertRaises(ValueError, pdpyras.tokenize_url_path,
            '/users/')
        self.assertEqual(('users','{index}'),
            pdpyras.tokenize_url_path('/users'))
github PagerDuty / pdpyras / test_pdpyras.py View on Github external
baseurl = 'https://rest.pd/'
        self.assertEqual(cm_path, pdpyras.tokenize_url_path(cm_path_str))
        self.assertEqual(cm_path, pdpyras.tokenize_url_path(baseurl+cm_path_str,
            baseurl=baseurl))
        self.assertRaises(ValueError, pdpyras.tokenize_url_path,
            '/https://api.pagerduty.com/?')
        self.assertRaises(ValueError, pdpyras.tokenize_url_path,
            'https://api.pagerduty.com/')
        self.assertRaises(ValueError, pdpyras.tokenize_url_path,
            'https://api.pagerduty.com')
        self.assertRaises(ValueError, pdpyras.tokenize_url_path,
            '/')
        self.assertRaises(ValueError, pdpyras.tokenize_url_path,
            '/users/')
        self.assertEqual(('users','{index}'),
            pdpyras.tokenize_url_path('/users'))