Files
@ 531ab818cc3d
Branch filter:
Location: kallithea/rhodecode/tests/models/test_license.py - annotation
531ab818cc3d
2.1 KiB
text/x-python
Add javascript for Object Code excanvas (flot) version herein included and use that instead of minified version.
I had a bit of trouble finding the upstream on excanvas, as the version from
Google, which appears to be the original source, seems unmaintained.
However, it appears the version we're carrying in Kallithea is indeed from
the excanvas era of flot.
$ (cd /tmp; \
svn -r 135 checkout http://flot.googlecode.com/svn/trunk/ flot )
$ cp /tmp/flot/excanvas.js rhodecode/public/js/excanvas.js
I also verified the sha256sum of the min file matched ours:
$ sha256sum /tmp/flot/excanvas.min.js rhodecode/public/js/excanvas.min.js
5f94b032a110504b7b261eaf71392fa3e8d82cdc6455c0cba5c9f03cd34ed122 /tmp/flot/excanvas.min.js
5f94b032a110504b7b261eaf71392fa3e8d82cdc6455c0cba5c9f03cd34ed122 rhodecode/public/js/excanvas.min.js
I had a bit of trouble finding the upstream on excanvas, as the version from
Google, which appears to be the original source, seems unmaintained.
However, it appears the version we're carrying in Kallithea is indeed from
the excanvas era of flot.
$ (cd /tmp; \
svn -r 135 checkout http://flot.googlecode.com/svn/trunk/ flot )
$ cp /tmp/flot/excanvas.js rhodecode/public/js/excanvas.js
I also verified the sha256sum of the min file matched ours:
$ sha256sum /tmp/flot/excanvas.min.js rhodecode/public/js/excanvas.min.js
5f94b032a110504b7b261eaf71392fa3e8d82cdc6455c0cba5c9f03cd34ed122 /tmp/flot/excanvas.min.js
5f94b032a110504b7b261eaf71392fa3e8d82cdc6455c0cba5c9f03cd34ed122 rhodecode/public/js/excanvas.min.js
ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 | from __future__ import with_statement
from rhodecode.tests import *
from rhodecode.tests.fixture import Fixture
from rhodecode.lib.compat import json
from rhodecode.model.license import LicenseModel
fixture = Fixture()
TEST_KEY = ''
class LicenseTest(BaseTestCase):
def setUp(self):
global TEST_KEY
token = LicenseModel.generate_license_token()
TEST_KEY = token
def test_encryption_decryption(self):
test_license = {
'foo': 'baar',
'signature': 'test'
}
enc = LicenseModel(key=TEST_KEY).encrypt(json.dumps(test_license))
dec = json.loads(LicenseModel(key=TEST_KEY).decrypt(enc))
self.assertEqual(test_license, dec)
def test_signature(self):
enc_with_key = '1234567890123456'
test_license = {
'foo': 'baar',
'signature': None
}
test_license['signature'] = LicenseModel(key=TEST_KEY)\
.generate_signature(test_license, enc_with_key)
enc = LicenseModel(key=TEST_KEY).encrypt(json.dumps(test_license))
signature = LicenseModel(key=TEST_KEY).verify(enc, enc_with_key)
del test_license['signature']
self.assertEqual(test_license, signature)
def test_signature_mismatch(self):
enc_with_key = '1234567890123456'
test_license = {
'foo': 'baar',
'signature': 'cnashs62tdsbcsaaisuda6215sagc'
}
enc = LicenseModel(key=TEST_KEY).encrypt(json.dumps(test_license))
self.assertRaises(TypeError,
lambda: LicenseModel(key=TEST_KEY).verify(enc, enc_with_key))
def test_generate_license_token(self):
token = LicenseModel.generate_license_token()
self.assertEqual(4, len(token.split('-')))
def test_get_license_info(self):
info = LicenseModel.get_license_info('', '')
self.assertEqual(info, {})
def test_get_license_info_default(self):
info = LicenseModel.get_license_info('', '', fill_defaults=True)
self.assertEqual(info['users'], 20)
self.assertEqual(info['valid_till'], 1421884937.512214)
self.assertEqual(info['email'], 'support@rhodecode.com')
|