Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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'))
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'))
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'))