##// END OF EJS Templates
fixed issue with cascade deleting of following entries
fixed issue with cascade deleting of following entries

File last commit:

r3063:ca2b2181 beta
r3067:9b0636e9 beta
Show More
test_admin.py
102 lines | 4.1 KiB | text/x-python | PythonLexer
Implemented better support for Wildcard queries...
r3063 import os
import csv
import datetime
renamed project to rhodecode
r547 from rhodecode.tests import *
Implemented better support for Wildcard queries...
r3063 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')
renamed project to rhodecode
r547
class TestAdminController(TestController):
Implemented better support for Wildcard queries...
r3063 @classmethod
def setup_class(cls):
UserLog.query().delete()
Session().commit()
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 = datetime.datetime.strptime(v, '%Y-%m-%d %H:%M:%S.%f')
setattr(ul, k, v)
Session().add(ul)
Session().commit()
@classmethod
def teardown_class(cls):
UserLog.query().delete()
Session().commit()
renamed project to rhodecode
r547 def test_index(self):
self.log_user()
response = self.app.get(url(controller='admin/admin', action='index'))
Implemented better support for Wildcard queries...
r3063 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_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_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_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')