Files
@ 6af3e67cc576
Branch filter:
Location: kallithea/rhodecode/tests/models/test_users.py - annotation
6af3e67cc576
4.4 KiB
text/x-python
Add Twitter's Bootstrap 3.0.0 CSS and Javascript files, under Apache License 2.0
These files are exactly as they appear the upstream release 3.0.0 of
Bootstrap, which Twitter released under the Apache License 2.0. To extract
these files, I did the following:
I downloaded the following file:
https://github.com/twbs/bootstrap/archive/v3.0.0.zip
with sha256sum of:
$ sha256sum v3.0.0.zip
2d54f345f4abc6bf65ea648c323e9bae577e6febf755650e62555f2d7a222e17 v3.0.0.zip
And extracted from it these two files:
bootstrap-3.0.0/dist/css/bootstrap.css
bootstrap-3.0.0/dist/js/bootstrap.js
which are licensed under the Apache License 2.0.
and placed them into:
rhodecode/public/css/bootstrap.css
rhodecode/public/js/bootstrap.js
respectively.
These files are exactly as they appear the upstream release 3.0.0 of
Bootstrap, which Twitter released under the Apache License 2.0. To extract
these files, I did the following:
I downloaded the following file:
https://github.com/twbs/bootstrap/archive/v3.0.0.zip
with sha256sum of:
$ sha256sum v3.0.0.zip
2d54f345f4abc6bf65ea648c323e9bae577e6febf755650e62555f2d7a222e17 v3.0.0.zip
And extracted from it these two files:
bootstrap-3.0.0/dist/css/bootstrap.css
bootstrap-3.0.0/dist/js/bootstrap.js
which are licensed under the Apache License 2.0.
and placed them into:
rhodecode/public/css/bootstrap.css
rhodecode/public/js/bootstrap.js
respectively.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | 95624ce4465f 95624ce4465f fa6ba6727475 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f ffd45b185016 7e3d89d9d3a2 7e3d89d9d3a2 7e3d89d9d3a2 95624ce4465f 95624ce4465f 5067d6e826a5 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 8a86836fad64 8a86836fad64 8a86836fad64 95624ce4465f 95624ce4465f 95624ce4465f ffd45b185016 ffd45b185016 95624ce4465f 95624ce4465f 95624ce4465f b8f929bff7e3 ffd45b185016 95624ce4465f 95624ce4465f ffd45b185016 95624ce4465f 95624ce4465f ffd45b185016 fa6ba6727475 95624ce4465f 95624ce4465f 95624ce4465f fa6ba6727475 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 5067d6e826a5 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 8a86836fad64 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f 95624ce4465f | from rhodecode.tests import *
from rhodecode.model.db import User, UserGroup, UserGroupMember, UserEmailMap,\
Permission
from rhodecode.model.user import UserModel
from rhodecode.model.meta import Session
from rhodecode.model.user_group import UserGroupModel
from rhodecode.tests.fixture import Fixture
fixture = Fixture()
class TestUser(BaseTestCase):
def __init__(self, methodName='runTest'):
Session.remove()
super(TestUser, self).__init__(methodName=methodName)
def tearDown(self):
Session.remove()
def test_create_and_remove(self):
usr = UserModel().create_or_update(username=u'test_user',
password=u'qweqwe',
email=u'u232@rhodecode.org',
firstname=u'u1', lastname=u'u1')
Session().commit()
self.assertEqual(User.get_by_username(u'test_user'), usr)
# make user group
user_group = fixture.create_user_group('some_example_group')
Session().commit()
UserGroupModel().add_user_to_group(user_group, usr)
Session().commit()
self.assertEqual(UserGroup.get(user_group.users_group_id), user_group)
self.assertEqual(UserGroupMember.query().count(), 1)
UserModel().delete(usr.user_id)
Session().commit()
self.assertEqual(UserGroupMember.query().all(), [])
def test_additonal_email_as_main(self):
usr = UserModel().create_or_update(username=u'test_user',
password=u'qweqwe',
email=u'main_email@rhodecode.org',
firstname=u'u1', lastname=u'u1')
Session().commit()
def do():
m = UserEmailMap()
m.email = u'main_email@rhodecode.org'
m.user = usr
Session().add(m)
Session().commit()
self.assertRaises(AttributeError, do)
UserModel().delete(usr.user_id)
Session().commit()
def test_extra_email_map(self):
usr = UserModel().create_or_update(username=u'test_user',
password=u'qweqwe',
email=u'main_email@rhodecode.org',
firstname=u'u1', lastname=u'u1')
Session().commit()
m = UserEmailMap()
m.email = u'main_email2@rhodecode.org'
m.user = usr
Session().add(m)
Session().commit()
u = User.get_by_email(email='main_email@rhodecode.org')
self.assertEqual(usr.user_id, u.user_id)
self.assertEqual(usr.username, u.username)
u = User.get_by_email(email='main_email2@rhodecode.org')
self.assertEqual(usr.user_id, u.user_id)
self.assertEqual(usr.username, u.username)
u = User.get_by_email(email='main_email3@rhodecode.org')
self.assertEqual(None, u)
UserModel().delete(usr.user_id)
Session().commit()
class TestUsers(BaseTestCase):
def __init__(self, methodName='runTest'):
super(TestUsers, self).__init__(methodName=methodName)
def setUp(self):
self.u1 = UserModel().create_or_update(username=u'u1',
password=u'qweqwe',
email=u'u1@rhodecode.org',
firstname=u'u1', lastname=u'u1')
def tearDown(self):
perm = Permission.query().all()
for p in perm:
UserModel().revoke_perm(self.u1, p)
UserModel().delete(self.u1)
Session().commit()
Session.remove()
def test_add_perm(self):
perm = Permission.query().all()[0]
UserModel().grant_perm(self.u1, perm)
Session().commit()
self.assertEqual(UserModel().has_perm(self.u1, perm), True)
def test_has_perm(self):
perm = Permission.query().all()
for p in perm:
has_p = UserModel().has_perm(self.u1, p)
self.assertEqual(False, has_p)
def test_revoke_perm(self):
perm = Permission.query().all()[0]
UserModel().grant_perm(self.u1, perm)
Session().commit()
self.assertEqual(UserModel().has_perm(self.u1, perm), True)
#revoke
UserModel().revoke_perm(self.u1, perm)
Session().commit()
self.assertEqual(UserModel().has_perm(self.u1, perm), False)
|