mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-07 09:51:26 +00:00
18
.travis.yml
18
.travis.yml
@@ -1,7 +1,10 @@
|
|||||||
language: python
|
language: python
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
global:
|
||||||
- CCNET_CONF_DIR=/tmp/ccnet SEAFILE_CONF_DIR=/tmp/seafile-data
|
- CCNET_CONF_DIR=/tmp/ccnet SEAFILE_CONF_DIR=/tmp/seafile-data
|
||||||
|
- secure: "AFqKit45l2758+TrH/l0SFN6k5lc9ALmZGPBGbGeYSzSGZ4+Cx7tHyQwgZgiitf9BzVci1ClaIMfNxp8BG6ECDAMXcbMyAksItG2aM/x//YT59ljgrwnNeZFfwh8LWuZslboxXx/Pfrv9QSX0c6dcTyEfKFLVKW1U2bn4MxdF+A="
|
||||||
|
|
||||||
|
|
||||||
# install & start seafile-server CE v6.3, install phantomjs & nginx
|
# install & start seafile-server CE v6.3, install phantomjs & nginx
|
||||||
before_install:
|
before_install:
|
||||||
@@ -10,21 +13,23 @@ before_install:
|
|||||||
- cd /tmp/seafile-test-deploy && ./bootstrap.sh && cd -
|
- cd /tmp/seafile-test-deploy && ./bootstrap.sh && cd -
|
||||||
# install phantomjs
|
# install phantomjs
|
||||||
- ./tests/install-deps.sh
|
- ./tests/install-deps.sh
|
||||||
|
- npm install -g requirejs
|
||||||
|
- openssl aes-256-cbc -K $encrypted_bdef00a70236_key -iv $encrypted_bdef00a70236_iv -in .travis/travis_deploy_key.enc -out travis_deploy_key -d && mv travis_deploy_key ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
|
||||||
|
|
||||||
# install seahub requirements
|
# install seahub requirements
|
||||||
install:
|
install:
|
||||||
- pip install -r requirements.txt --allow-all-external --allow-unverified PIL
|
- pip install -r requirements.txt --allow-all-external --allow-unverified PIL
|
||||||
- pip install -r test-requirements.txt
|
- pip install -r test-requirements.txt
|
||||||
|
|
||||||
# int & start seahub server
|
before_scipt: true
|
||||||
before_scipt:
|
|
||||||
- ./tests/seahubtests.sh init && ./tests/seahubtests.sh runserver
|
|
||||||
|
|
||||||
# run seahub tests
|
# int & start seahub server, run seahub tests
|
||||||
script:
|
script:
|
||||||
- ./tests/seahubtests.sh test
|
- ./tests/seahubtests.sh init && ./tests/seahubtests.sh runserver && ./tests/seahubtests.sh test
|
||||||
|
|
||||||
after_success: true
|
after_success:
|
||||||
|
- ./tests/seahubtests.sh dist
|
||||||
|
- .travis/dist_and_push.sh
|
||||||
|
|
||||||
after_failure: true
|
after_failure: true
|
||||||
|
|
||||||
@@ -42,3 +47,4 @@ branches:
|
|||||||
- master
|
- master
|
||||||
- 6.3
|
- 6.3
|
||||||
- 6.2
|
- 6.2
|
||||||
|
- 6.3-fix_test
|
20
.travis/dist_and_push.sh
Executable file
20
.travis/dist_and_push.sh
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
commit_media_files() {
|
||||||
|
git checkout -b dist-$TRAVIS_BRANCH
|
||||||
|
git add -u . && git add -A media/assets && git add -A static/scripts
|
||||||
|
git commit -m "[dist] Travis build: #$TRAVIS_BUILD_NUMBER, based on commit $TRAVIS_COMMIT." -m "https://travis-ci.org/haiwen/seahub/builds/$TRAVIS_BUILD_ID" -m "$TRAVIS_COMMIT_MESSAGE"
|
||||||
|
}
|
||||||
|
|
||||||
|
upload_files() {
|
||||||
|
git push git@github.com:haiwen/seahub.git dist-$TRAVIS_BRANCH -f
|
||||||
|
}
|
||||||
|
|
||||||
|
make_dist() {
|
||||||
|
make dist
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# make_dist
|
||||||
|
commit_media_files
|
||||||
|
upload_files
|
BIN
.travis/travis_deploy_key.enc
Normal file
BIN
.travis/travis_deploy_key.enc
Normal file
Binary file not shown.
@@ -35,6 +35,15 @@ class SharedReposTest(BaseTestCase):
|
|||||||
self.admin_name = self.admin.username
|
self.admin_name = self.admin.username
|
||||||
self.url = reverse('api-v2.1-shared-repos')
|
self.url = reverse('api-v2.1-shared-repos')
|
||||||
|
|
||||||
|
# make sure this user has not sharing any repos
|
||||||
|
for x in seafile_api.get_share_out_repo_list(self.user_name, -1, -1):
|
||||||
|
seafile_api.remove_share(x.repo_id, self.user_name, x.user)
|
||||||
|
assert len(seafile_api.get_share_out_repo_list(self.user_name, -1, -1)) == 0
|
||||||
|
|
||||||
|
for x in seafile_api.get_group_repos_by_owner(self.user_name):
|
||||||
|
seafile_api.unset_group_repo(x.repo_id, x.group_id, self.user_name)
|
||||||
|
assert len(seafile_api.get_group_repos_by_user(self.user_name)) == 0
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
seafile_api.remove_share(self.repo_id, self.user_name, self.admin_name)
|
seafile_api.remove_share(self.repo_id, self.user_name, self.admin_name)
|
||||||
seafile_api.unset_group_repo(self.repo_id, self.group_id, self.user_name)
|
seafile_api.unset_group_repo(self.repo_id, self.group_id, self.user_name)
|
||||||
@@ -52,18 +61,22 @@ class SharedReposTest(BaseTestCase):
|
|||||||
p.save()
|
p.save()
|
||||||
|
|
||||||
self.login_as(self.user)
|
self.login_as(self.user)
|
||||||
resp = self.client.get(self.url)
|
resp = self.client.get(self.url + '?share_type=personal')
|
||||||
self.assertEqual(200, resp.status_code)
|
self.assertEqual(200, resp.status_code)
|
||||||
json_resp = json.loads(resp.content)
|
json_resp = json.loads(resp.content)
|
||||||
|
|
||||||
assert json_resp[0]['share_type'] == 'personal'
|
assert 'personal' in [x['share_type'] for x in json_resp]
|
||||||
assert json_resp[0]['repo_id'] == self.repo_id
|
for r in json_resp:
|
||||||
assert json_resp[0]['user_email'] == self.admin_name
|
if r['share_type'] != 'personal':
|
||||||
assert json_resp[0]['user_name'] == nickname
|
continue
|
||||||
assert json_resp[0]['contact_email'] == contact_email
|
|
||||||
assert len(json_resp[0]['modifier_email']) > 0
|
assert r['repo_id'] == self.repo_id
|
||||||
assert len(json_resp[0]['modifier_name']) > 0
|
assert r['user_email'] == self.admin_name
|
||||||
assert len(json_resp[0]['modifier_contact_email']) > 0
|
assert r['user_name'] == nickname
|
||||||
|
assert r['contact_email'] == contact_email
|
||||||
|
assert len(r['modifier_email']) > 0
|
||||||
|
assert len(r['modifier_name']) > 0
|
||||||
|
assert len(r['modifier_contact_email']) > 0
|
||||||
|
|
||||||
def test_can_get_when_share_to_group(self):
|
def test_can_get_when_share_to_group(self):
|
||||||
self.share_repo_to_group()
|
self.share_repo_to_group()
|
||||||
@@ -73,9 +86,13 @@ class SharedReposTest(BaseTestCase):
|
|||||||
self.assertEqual(200, resp.status_code)
|
self.assertEqual(200, resp.status_code)
|
||||||
json_resp = json.loads(resp.content)
|
json_resp = json.loads(resp.content)
|
||||||
|
|
||||||
assert json_resp[0]['share_type'] == 'group'
|
assert 'group' in [x['share_type'] for x in json_resp]
|
||||||
assert json_resp[0]['repo_id'] == self.repo_id
|
for r in json_resp:
|
||||||
assert json_resp[0]['group_id'] == self.group_id
|
if r['share_type'] != 'group':
|
||||||
|
continue
|
||||||
|
|
||||||
|
assert r['repo_id'] == self.repo_id
|
||||||
|
assert r['group_id'] == self.group_id
|
||||||
|
|
||||||
@pytest.mark.skipif(TRAVIS, reason="") # pylint: disable=E1101
|
@pytest.mark.skipif(TRAVIS, reason="") # pylint: disable=E1101
|
||||||
def test_can_get_when_share_to_org_group(self):
|
def test_can_get_when_share_to_org_group(self):
|
||||||
@@ -85,6 +102,7 @@ class SharedReposTest(BaseTestCase):
|
|||||||
resp = self.client.get(self.url)
|
resp = self.client.get(self.url)
|
||||||
self.assertEqual(200, resp.status_code)
|
self.assertEqual(200, resp.status_code)
|
||||||
json_resp = json.loads(resp.content)
|
json_resp = json.loads(resp.content)
|
||||||
|
assert len(json_resp) == 1
|
||||||
|
|
||||||
assert json_resp[0]['share_type'] == 'group'
|
assert json_resp[0]['share_type'] == 'group'
|
||||||
assert json_resp[0]['repo_id'] == self.org_repo.id
|
assert json_resp[0]['repo_id'] == self.org_repo.id
|
||||||
@@ -94,11 +112,11 @@ class SharedReposTest(BaseTestCase):
|
|||||||
self.share_repo_to_public()
|
self.share_repo_to_public()
|
||||||
|
|
||||||
self.login_as(self.user)
|
self.login_as(self.user)
|
||||||
resp = self.client.get(self.url)
|
resp = self.client.get(self.url + '?share_type=public')
|
||||||
self.assertEqual(200, resp.status_code)
|
self.assertEqual(200, resp.status_code)
|
||||||
json_resp = json.loads(resp.content)
|
json_resp = json.loads(resp.content)
|
||||||
|
|
||||||
assert json_resp[0]['share_type'] == 'public'
|
assert 'public' in [x['share_type'] for x in json_resp]
|
||||||
|
|
||||||
def test_get_with_invalid_repo_permission(self):
|
def test_get_with_invalid_repo_permission(self):
|
||||||
|
|
||||||
|
@@ -174,18 +174,17 @@ class BatchAddUserTest(BaseTestCase):
|
|||||||
self.new_users = []
|
self.new_users = []
|
||||||
self.excel_file = os.path.join(os.getcwd(), 'tests/seahub/views/sysadmin/batch_add_user.xlsx')
|
self.excel_file = os.path.join(os.getcwd(), 'tests/seahub/views/sysadmin/batch_add_user.xlsx')
|
||||||
data_list = []
|
data_list = []
|
||||||
data_list.append(['email', 'password', 'username', 'department', 'role', 'quota'])
|
data_list.append(['email', 'password', 'username', 'role', 'quota'])
|
||||||
for i in xrange(20):
|
for i in xrange(20):
|
||||||
username = "username@test" + str(i) +".com"
|
username = "username@test" + str(i) +".com"
|
||||||
password = "password"
|
password = "password"
|
||||||
name = "name_test" + str(i)
|
name = "name_test" + str(i)
|
||||||
department = "department_test" + str(i)
|
|
||||||
if i < 10:
|
if i < 10:
|
||||||
role = "guest"
|
role = "guest"
|
||||||
else:
|
else:
|
||||||
role = "default"
|
role = "default"
|
||||||
quota = "999"
|
quota = "999"
|
||||||
data_list.append([username, password, name, department, role, quota])
|
data_list.append([username, password, name, role, quota])
|
||||||
self.new_users.append(username)
|
self.new_users.append(username)
|
||||||
wb = real_write_xls('test', data_list[0], data_list[1:])
|
wb = real_write_xls('test', data_list[0], data_list[1:])
|
||||||
wb.save(self.excel_file)
|
wb.save(self.excel_file)
|
||||||
@@ -318,7 +317,6 @@ class BatchAddUserHelpTest(BaseTestCase):
|
|||||||
assert r[0].value == 'test' + str(i) + '@example.com'
|
assert r[0].value == 'test' + str(i) + '@example.com'
|
||||||
assert r[1].value == '123456'
|
assert r[1].value == '123456'
|
||||||
assert r[2].value == 'test' + str(i)
|
assert r[2].value == 'test' + str(i)
|
||||||
assert r[3].value == 'department' + str(i)
|
assert r[3].value == 'default'
|
||||||
assert r[4].value == 'default'
|
assert r[4].value == '1000'
|
||||||
assert r[5].value == '1000'
|
|
||||||
i += 1
|
i += 1
|
||||||
|
@@ -54,6 +54,12 @@ function start_seahub() {
|
|||||||
sleep 5
|
sleep 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function make_dist() {
|
||||||
|
echo "Making dist files ..."
|
||||||
|
|
||||||
|
make dist
|
||||||
|
}
|
||||||
|
|
||||||
function check_phantom_js() {
|
function check_phantom_js() {
|
||||||
if ! which phantomjs >/dev/null; then
|
if ! which phantomjs >/dev/null; then
|
||||||
echo "Please install phantojs first:"
|
echo "Please install phantojs first:"
|
||||||
@@ -71,7 +77,7 @@ function run_tests() {
|
|||||||
rvalue=$?
|
rvalue=$?
|
||||||
if [[ ${TRAVIS} != "" ]]; then
|
if [[ ${TRAVIS} != "" ]]; then
|
||||||
# On travis-ci, dump seahub logs when test finished
|
# On travis-ci, dump seahub logs when test finished
|
||||||
for logfile in /tmp/seahub*.log; do
|
for logfile in /tmp/ccnet/*.log /tmp/seafile-data/*.log /tmp/seahub*.log; do
|
||||||
echo -e "\nLog file $logfile:\n"
|
echo -e "\nLog file $logfile:\n"
|
||||||
cat "${logfile}"
|
cat "${logfile}"
|
||||||
echo
|
echo
|
||||||
@@ -87,6 +93,9 @@ case $1 in
|
|||||||
"runserver")
|
"runserver")
|
||||||
start_seahub
|
start_seahub
|
||||||
;;
|
;;
|
||||||
|
"dist")
|
||||||
|
make_dist
|
||||||
|
;;
|
||||||
"test")
|
"test")
|
||||||
shift
|
shift
|
||||||
nose_opts=$*
|
nose_opts=$*
|
||||||
|
Reference in New Issue
Block a user