view .travis.yml @ 6510:3505a6be2988

repogroups: fix private repo recursion check The purpose of this check is to ensure that we don't recursively assign "default" user perms for a repo with the "private" flag set (because in that case, the "default" user perms should always be "no access"). (The check, and this fix, is of course only applicable to Kallithea instances that have anonymous access enabled to begin with.) However, the check was only functional if the user was specified as a username. This is apparently always the case when Kallithea is running, but was not e.g. the case in the test suite, which consistently passed a user ID instead of a username. This commit ensures that the user is always resolved before the check is made. There's no significant overhead to this, as the code immediately calls RepoModel().grant_user_permission, which resolved the user anyway. This change just moves the database lookup a bit earlier. Fixing this revealed the matching test case to be broken, so it has been fixed as well. Down the road, we should eliminate Kallithea's bizarre practice of passing around usernames and user IDs, in favor of passing actual User objects. That'll get rid of mistakes like these, as well as repeated needless database lookups.
author Søren Løvborg <sorenl@unity3d.com>
date Thu, 23 Feb 2017 20:26:27 +0100
parents e285bb7abb28
children
line wrap: on
line source

language: python
python:
  - "2.6"
  - "2.7"

env:
  - TEST_DB=sqlite:////tmp/kallithea_test.sqlite
  - TEST_DB=mysql://root@127.0.0.1/kallithea_test
  - TEST_DB=postgresql://postgres@127.0.0.1/kallithea_test

services:
  - mysql
  - postgresql

# command to install dependencies
before_script:
  - mysql -e 'create database kallithea_test;'
  - psql -c 'create database kallithea_test;' -U postgres
  - git --version

before_install:
  - sudo apt-get remove git
  - sudo add-apt-repository ppa:pdoes/ppa -y
  - sudo apt-get update -y
  - sudo apt-get install git -y

install:
  - pip install mysql-python psycopg2 mock unittest2
  - pip install . --use-mirrors

# command to run tests
script: nosetests

notifications:
    email:
        - ci@kallithea-scm.org
    irc: "irc.freenode.org#kallithea"

branches:
  only:
    - master