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_sign(self):
self.assertTrue(re.search('nonce=', recurly.js.sign()))
self.assertTrue(re.search('timestamp=', recurly.js.sign()))
self.assertEqual(
recurly.js.sign({'timestamp': 1312701386, 'nonce': 1}),
'015662c92688f387159bcac9bc1fb250a1327886|nonce=1×tamp=1312701386'
)
self.assertEqual(
recurly.js.sign(recurly.Account(account_code='1'), {'timestamp': 1312701386, 'nonce': 1}),
'82bcbbd4deb8b1b663b7407d9085dc67e2922df7|account%5Baccount_code%5D=1&nonce=1×tamp=1312701386'
)
def test_sign(self):
self.assertTrue(re.search('nonce=', recurly.js.sign()))
self.assertTrue(re.search('timestamp=', recurly.js.sign()))
self.assertEqual(
recurly.js.sign({'timestamp': 1312701386, 'nonce': 1}),
'015662c92688f387159bcac9bc1fb250a1327886|nonce=1×tamp=1312701386'
)
self.assertEqual(
recurly.js.sign(recurly.Account(account_code='1'), {'timestamp': 1312701386, 'nonce': 1}),
'82bcbbd4deb8b1b663b7407d9085dc67e2922df7|account%5Baccount_code%5D=1&nonce=1×tamp=1312701386'
)
def test_sign(self):
self.assertTrue(re.search('nonce=', recurly.js.sign()))
self.assertTrue(re.search('timestamp=', recurly.js.sign()))
self.assertEqual(
recurly.js.sign({'timestamp': 1312701386, 'nonce': 1}),
'015662c92688f387159bcac9bc1fb250a1327886|nonce=1×tamp=1312701386'
)
self.assertEqual(
recurly.js.sign(recurly.Account(account_code='1'), {'timestamp': 1312701386, 'nonce': 1}),
'82bcbbd4deb8b1b663b7407d9085dc67e2922df7|account%5Baccount_code%5D=1&nonce=1×tamp=1312701386'
)
def generate_signature(self):
# workaround for http://bugs.python.org/issue5285, map unicode to strings
settings = get_settings()
recurly.API_KEY = str(settings.recurly_api_key)
recurly.js.PRIVATE_KEY = str(settings.recurly_private_key)
plan_code = str(settings.recurly_plan_code)
# Set a default currency for your API requests
recurly.DEFAULT_CURRENCY = 'USD'
return recurly.js.sign({'subscription': {'plan_code': plan_code}})