diff --git a/debexpo/controllers/login.py b/debexpo/controllers/login.py
index 9fb7b3aeb85087d273ae633127e24989cc14cc67..f1c3c69ffe57d7d7f8db477fdc099ac37a87026e 100644
--- a/debexpo/controllers/login.py
+++ b/debexpo/controllers/login.py
@@ -44,6 +44,9 @@ from debexpo.lib.schemas import LoginForm
from debexpo.model import meta
from debexpo.model.users import User
+import debexpo.model
+import debexpo.model.user_upload_key
+
import debexpo.lib.utils
log = logging.getLogger(__name__)
@@ -99,6 +102,13 @@ class LoginController(BaseController):
else:
path = url('my')
+ # Purge the session upload key
+ keys = meta.session.query(debexpo.model.user_upload_key.UserUploadKey
+ ).filter_by(user=u)
+ if keys:
+ for key in keys:
+ meta.session.delete(key)
+
meta.session.commit()
redirect(path)
@@ -110,6 +120,8 @@ class LoginController(BaseController):
If True, display the form even if request.method is POST.
"""
+
+ c.request = request
if request.method == 'POST' and get is False:
log.debug('Login form submitted with email = "%s"' % request.POST.get('email'))
return self._login()
diff --git a/debexpo/templates/login/index.mako b/debexpo/templates/login/index.mako
index 7413fdb8d97e2e662ae99da178c9361fafab236f..9613a144c09da3c42156a8da6ccc2e93b31e91e1 100644
--- a/debexpo/templates/login/index.mako
+++ b/debexpo/templates/login/index.mako
@@ -32,6 +32,10 @@
${ h.html.tags.end_form() }
+% if c.request and c.request.scheme == 'http':
+
Secure log-in: ${ _('Switch to SSL') }
+% endif
+
${ _('Did you lose your password?')}
${ _('Try resetting your password.')}
diff --git a/debexpo/tests/functional/test_packages.py b/debexpo/tests/functional/test_packages.py
index 38afbabf02caea16655c910fd6bee4a780988efb..36ddbcd03264a7a18b4d4ba62a7bf459abff7cc1 100644
--- a/debexpo/tests/functional/test_packages.py
+++ b/debexpo/tests/functional/test_packages.py
@@ -61,10 +61,13 @@ class TestPackagesController(TestController):
self.assertEquals('text/html', response.content_type)
def test_uploader(self):
+ response = self.app.get(url('packages-uploader', id='nonexistant@example.com'), expect_errors = True)
+ self.assertEquals(404, response.status_int)
response = self.app.get(url('packages-uploader', id='email@example.com'))
self.assertEquals(200, response.status_int)
self.assertEquals('text/html', response.content_type)
+
def test_my(self):
response = self.app.get(url(controller='packages', action='my'))
self.assertEquals(302, response.status_int)
diff --git a/debexpo/tests/test_filesystem.py b/debexpo/tests/test_filesystem.py
new file mode 100644
index 0000000000000000000000000000000000000000..bab3a97c96dcb622b8f5da8e75a23b331834d996
--- /dev/null
+++ b/debexpo/tests/test_filesystem.py
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+#
+# test_filesystem.py — CheckFiles class test cases
+#
+# This file is part of debexpo - https://alioth.debian.org/projects/debexpo/
+#
+# Copyright © 2012 Nicolas Dandrimont
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation
+# files (the "Software"), to deal in the Software without
+# restriction, including without limitation the rights to use,
+# copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following
+# conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+"""
+CheckFiles class test cases.
+"""
+
+__author__ = 'Nicolas Dandrimont'
+__copyright__ = 'Copyright © 2012 Nicolas Dandrimont'
+__license__ = 'MIT'
+
+from unittest import TestCase
+
+from debexpo.lib.filesystem import CheckFiles
+
+class TestCheckFilesController(TestCase):
+
+ def setUp(self):
+ """
+ Setup the environment for tests
+ """
+ self.checkfiles = CheckFiles()
+
+ def testAllowedUpload(self):
+ """
+ Tests CheckFiles.allowed_upload
+ """
+ t = self.checkfiles.allowed_upload
+
+ self.assertTrue(t('foo_version.orig.tar.gz'))
+ self.assertTrue(t('foo_version.tar.gz'))
+ self.assertTrue(t('foo_version.changes'))
+ self.assertTrue(t('foo_version.dsc'))
+ self.assertTrue(t('foo_version.deb'))
+ self.assertTrue(t('foo_version.diff.gz'))
+
+ self.assertFalse(t('foo_version.etc'))
+
diff --git a/debexpo/websetup.py b/debexpo/websetup.py
index a322f2eca8893232eb3cc53178c3ae25aca6e0af..5c75ae60d0c5208ae541a425656c832a628bc03a 100644
--- a/debexpo/websetup.py
+++ b/debexpo/websetup.py
@@ -83,14 +83,14 @@ def setup_config(command, filename, section, vars):
if not os.path.isdir(config['debexpo.upload.incoming']):
log.info('Creating incoming directory')
- os.mkdir(config['debexpo.upload.incoming'])
- os.mkdir(os.path.join(config['debexpo.upload.incoming'], 'pub'))
+ os.makedirs(config['debexpo.upload.incoming'])
+ os.makedirs(os.path.join(config['debexpo.upload.incoming'], 'pub'))
else:
log.info('Incoming directory already exists')
if not os.path.isdir(config['debexpo.repository']):
log.info('Creating repository directory')
- os.mkdir(config['debexpo.repository'])
+ os.makedirs(config['debexpo.repository'])
else:
log.info('Repository directory already exists')
diff --git a/test.ini b/test.ini
index e043518d544a425ef2ce396d768a36fe8c805970..a6c02ad3d0ec0e0766dfd3a51e9b8619b2254ac7 100644
--- a/test.ini
+++ b/test.ini
@@ -8,6 +8,8 @@ debug = true
# Uncomment and replace with the address which should receive any error reports
#email_to = you@yourdomain.com
smtp_server = localhost
+smtp_username =
+smtp_password =
error_email_from = paste@localhost
[server:main]
@@ -24,7 +26,7 @@ beaker.session.secret = somesecret
sqlalchemy.url = sqlite://
# Directory name to add incoming uploaded files into
-debexpo.upload.incoming = /tmp/debexpo/
+debexpo.upload.incoming = /tmp/debexpo/incoming/
# Directory name to store accepted uploaded files
debexpo.repository = /tmp/debexpo/files/
@@ -35,6 +37,9 @@ debexpo.importer = %(here)s/bin/debexpo-importer
# Whether to let debexpo handle the /debian/ directory
debexpo.handle_debian = true
+# Site title (e.g. short name)
+debexpo.sitetitle = Mentors
+
# Site name
debexpo.sitename = debexpo
@@ -51,25 +56,55 @@ debexpo.email = email@example.org
debexpo.debian_specific = true
# What post-upload plugins to run, in this order
-debexpo.plugins.post_upload = checkfiles
+debexpo.plugins.post_upload = getorigtarball notuploader
# What qa plugins to run, in this order
-debexpo.plugins.qa =
+debexpo.plugins.qa = lintian native maintaineremail watchfile closedbugs controlfields diffclean buildsystem debianqa distribution
-# Path to the gpg binary
-debexpo.gpg_path = /usr/bin/gpg
+# What plugins to run when the package is uploaded to Debian, in this order
+debexpo.plugins.post_upload_to_debian = removepackage
+
+# What plugins to run when a package is successfully uploaded, in this order
+debexpo.plugins.post_successful_upload = changeslist
+
+# Extra plugin directory
+debexpo.plugindir = /tmp
+
+# Location of the nearest Debian mirror
+debexpo.debian_mirror = http://ftp.uk.debian.org/debian
+
+# Email address to send package accepts to
+debexpo.changes_list = changes@example.com
# Server debexpo is being run on including http:// and excluding trailing slash
debexpo.server = http://localhost:5000
-debexpo.sitetitle = Testing
-
-debexpo.gpg_keyring = /tmp/keyring
+# Path to the gpg binary
+debexpo.gpg_path = /usr/bin/gpg
-debexpo.enable_experimental_code = False
+# Path to the mentors keyring
+debexpo.gpg_keyring = /tmp/debexpo-keyring.gpg
+# Minimum key strength required for the key to be acceptable in Debian keyring.
debexpo.gpg_minkeystrength = 2048
+# Cronjobs to run by the Worker task
+debexpo.cronjobs = removeolduploads importuploads
+
+# Extra plugin directory
+debexpo.cronjobdir = /tmp
+
+# Debexpo cronjob Worker iteration delay.
+# The worker will sleep that amount of seconds after each run
+debexpo.cronjob_delay = 60
+
+# NNTP server to connect to fetch mailing list comments/changes
+debexpo.nntp_server = news.gmane.org
+
+# Enable experimental and/or broken code
+debexpo.enable_experimental_code = true
+
+# Logging configuration
[loggers]
keys = root, debexpo