Files
@ ffd45b185016
Branch filter:
Location: kallithea/rhodecode/tests/functional/test_admin.py
ffd45b185016
6.0 KiB
text/x-python
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
This imports changes between changesets 21af6c4eab3d and 6177597791c2 in
RhodeCode's original repository, including only changes to Python files and HTML.
RhodeCode clearly licensed its changes to these files under GPLv3
in their /LICENSE file, which states the following:
The Python code and integrated HTML are licensed under the GPLv3 license.
(See:
https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE
or
http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE
for an online copy of that LICENSE file)
Conservancy reviewed these changes and confirmed that they can be licensed as
a whole to the Kallithea project under GPLv3-only.
While some of the contents committed herein are clearly licensed
GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the
statement above from RhodeCode indicates that they intend GPLv3-only as their
license, per GPLv3ยง14 and other relevant sections of GPLv3.
This imports changes between changesets 21af6c4eab3d and 6177597791c2 in
RhodeCode's original repository, including only changes to Python files and HTML.
RhodeCode clearly licensed its changes to these files under GPLv3
in their /LICENSE file, which states the following:
The Python code and integrated HTML are licensed under the GPLv3 license.
(See:
https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE
or
http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE
for an online copy of that LICENSE file)
Conservancy reviewed these changes and confirmed that they can be licensed as
a whole to the Kallithea project under GPLv3-only.
While some of the contents committed herein are clearly licensed
GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the
statement above from RhodeCode indicates that they intend GPLv3-only as their
license, per GPLv3ยง14 and other relevant sections of GPLv3.
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 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | from __future__ import with_statement
import os
import csv
import datetime
from rhodecode.tests import *
from rhodecode.model.db import UserLog
from rhodecode.model.meta import Session
from rhodecode.lib.utils2 import safe_unicode
dn = os.path.dirname
FIXTURES = os.path.join(dn(dn(os.path.abspath(__file__))), 'fixtures')
class TestAdminController(TestController):
@classmethod
def setup_class(cls):
UserLog.query().delete()
Session().commit()
def strptime(val):
fmt = '%Y-%m-%d %H:%M:%S'
if '.' not in val:
return datetime.datetime.strptime(val, fmt)
nofrag, frag = val.split(".")
date = datetime.datetime.strptime(nofrag, fmt)
frag = frag[:6] # truncate to microseconds
frag += (6 - len(frag)) * '0' # add 0s
return date.replace(microsecond=int(frag))
with open(os.path.join(FIXTURES, 'journal_dump.csv')) as f:
for row in csv.DictReader(f):
ul = UserLog()
for k, v in row.iteritems():
v = safe_unicode(v)
if k == 'action_date':
v = strptime(v)
if k in ['user_id', 'repository_id']:
# nullable due to FK problems
v = None
setattr(ul, k, v)
Session().add(ul)
Session().commit()
@classmethod
def teardown_class(cls):
UserLog.query().delete()
Session().commit()
def test_index(self):
self.log_user()
response = self.app.get(url(controller='admin/admin', action='index'))
response.mustcontain('Admin journal')
def test_filter_all_entries(self):
self.log_user()
response = self.app.get(url(controller='admin/admin', action='index',))
response.mustcontain('2034 entries')
def test_filter_journal_filter_exact_match_on_repository(self):
self.log_user()
response = self.app.get(url(controller='admin/admin', action='index',
filter='repository:rhodecode'))
response.mustcontain('3 entries')
def test_filter_journal_filter_exact_match_on_repository_CamelCase(self):
self.log_user()
response = self.app.get(url(controller='admin/admin', action='index',
filter='repository:RhodeCode'))
response.mustcontain('3 entries')
def test_filter_journal_filter_wildcard_on_repository(self):
self.log_user()
response = self.app.get(url(controller='admin/admin', action='index',
filter='repository:*test*'))
response.mustcontain('862 entries')
def test_filter_journal_filter_prefix_on_repository(self):
self.log_user()
response = self.app.get(url(controller='admin/admin', action='index',
filter='repository:test*'))
response.mustcontain('257 entries')
def test_filter_journal_filter_prefix_on_repository_CamelCase(self):
self.log_user()
response = self.app.get(url(controller='admin/admin', action='index',
filter='repository:Test*'))
response.mustcontain('257 entries')
def test_filter_journal_filter_prefix_on_repository_and_user(self):
self.log_user()
response = self.app.get(url(controller='admin/admin', action='index',
filter='repository:test* AND username:demo'))
response.mustcontain('130 entries')
def test_filter_journal_filter_prefix_on_repository_or_other_repo(self):
self.log_user()
response = self.app.get(url(controller='admin/admin', action='index',
filter='repository:test* OR repository:rhodecode'))
response.mustcontain('260 entries') # 257 + 3
def test_filter_journal_filter_exact_match_on_username(self):
self.log_user()
response = self.app.get(url(controller='admin/admin', action='index',
filter='username:demo'))
response.mustcontain('1087 entries')
def test_filter_journal_filter_exact_match_on_username_camelCase(self):
self.log_user()
response = self.app.get(url(controller='admin/admin', action='index',
filter='username:DemO'))
response.mustcontain('1087 entries')
def test_filter_journal_filter_wildcard_on_username(self):
self.log_user()
response = self.app.get(url(controller='admin/admin', action='index',
filter='username:*test*'))
response.mustcontain('100 entries')
def test_filter_journal_filter_prefix_on_username(self):
self.log_user()
response = self.app.get(url(controller='admin/admin', action='index',
filter='username:demo*'))
response.mustcontain('1101 entries')
def test_filter_journal_filter_prefix_on_user_or_other_user(self):
self.log_user()
response = self.app.get(url(controller='admin/admin', action='index',
filter='username:demo OR username:volcan'))
response.mustcontain('1095 entries') # 1087 + 8
def test_filter_journal_filter_wildcard_on_action(self):
self.log_user()
response = self.app.get(url(controller='admin/admin', action='index',
filter='action:*pull_request*'))
response.mustcontain('187 entries')
def test_filter_journal_filter_on_date(self):
self.log_user()
response = self.app.get(url(controller='admin/admin', action='index',
filter='date:20121010'))
response.mustcontain('47 entries')
def test_filter_journal_filter_on_date_2(self):
self.log_user()
response = self.app.get(url(controller='admin/admin', action='index',
filter='date:20121020'))
response.mustcontain('17 entries')
|