Commit 009e51b738aca5ee415ed35c6b0eff843f1b4a42
1 parent
5fe84f6f
Exists in
master
and in
1 other branch
Add/fix colab_gitlab tests
Signed-off-by: Gustavo Jaruga <darksshades@gmail.com> Signed-off-by: Alexandre Barbosa <alexandreab@live.com>
Showing
8 changed files
with
151 additions
and
33 deletions
Show diff stats
.gitignore
MANIFEST.in
setup.py
| 1 | +import codecs | |
| 2 | +import os | |
| 3 | +import re | |
| 1 | 4 | |
| 2 | -from setuptools import setup, find_packages | |
| 3 | -from pip.download import PipSession | |
| 4 | -from pip.req import parse_requirements | |
| 5 | +from setuptools import setup | |
| 5 | 6 | |
| 6 | -import os | |
| 7 | 7 | # if you are not using vagrant, just delete os.link directly, |
| 8 | 8 | # The hard link only saves a little disk space, so you should not care |
| 9 | 9 | if os.environ.get('USER', '') == 'vagrant': |
| 10 | 10 | del os.link |
| 11 | 11 | |
| 12 | -session = PipSession() | |
| 13 | -reqs = [str(req.req) for req in parse_requirements('requirements.txt', | |
| 14 | - session=session) if req.req] | |
| 12 | +def read(*parts): | |
| 13 | + return codecs.open(os.path.join(os.path.dirname(__file__), *parts), | |
| 14 | + encoding='utf8').read() | |
| 15 | + | |
| 15 | 16 | |
| 16 | -EXCLUDE_FROM_PACKAGES = [] | |
| 17 | +def find_version(*file_paths): | |
| 18 | + version_file = read(*file_paths) | |
| 19 | + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", | |
| 20 | + version_file, re.M) | |
| 21 | + if version_match: | |
| 22 | + return version_match.group(1) | |
| 23 | + raise RuntimeError("Unable to find version string.") | |
| 17 | 24 | |
| 18 | 25 | |
| 19 | 26 | setup( |
| 20 | 27 | name='colab-gitlab', |
| 21 | - version='0.1.0', | |
| 22 | - url='https://github.com/colab-community/colab_gitlab', | |
| 28 | + url='https://github.com/colab/colab_gitlab', | |
| 29 | + description='Yet another Django reverse proxy application.', | |
| 30 | + version=find_version('colab_gitlab/__init__.py'), | |
| 31 | + long_description=read('README.rst'), | |
| 32 | + packages=['colab_gitlab'], | |
| 33 | + install_requires=[ | |
| 34 | + 'colab', | |
| 35 | + ], | |
| 36 | + tests_require=['mock', 'diazo', ], | |
| 37 | + test_suite="tests.run.runtests", | |
| 23 | 38 | author='Sergio Oliveira', |
| 24 | 39 | author_email='sergio@tracy.com.br', |
| 25 | - description= | |
| 26 | - 'Gitlab plugin for Colab, a colaboration platform for communities', | |
| 27 | - license='LICENSE.txt', | |
| 28 | - packages=find_packages(exclude="EXCLUDE_FROM_PACKAGES"), | |
| 29 | - include_package_data=True, | |
| 30 | - namespace_packages=['colab', 'colab.proxy'], | |
| 31 | - zip_safe=False, | |
| 32 | - long_description=open('README.rst').read(), | |
| 33 | - install_requires=reqs, | |
| 34 | - classifiers=[ | |
| 35 | - 'Development Status :: 3 - Alpha', | |
| 36 | - 'Environment :: Web Environment', | |
| 37 | - 'Framework :: Django', | |
| 38 | - 'Intended Audience :: Developers', | |
| 39 | - 'Operating System :: OS Independent', | |
| 40 | - 'Programming Language :: Python', | |
| 41 | - 'Programming Language :: Python :: 2', | |
| 42 | - 'Programming Language :: Python :: 2.7', | |
| 43 | - 'Topic :: Internet :: WWW/HTTP', | |
| 44 | - 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', | |
| 45 | - 'Topic :: Internet :: WWW/HTTP :: WSGI', | |
| 46 | - ], | |
| 40 | + license='GPL 2.0', | |
| 41 | + classifiers=[ | |
| 42 | + 'Development Status :: 3 - Alpha', | |
| 43 | + 'Environment :: Web Environment', | |
| 44 | + 'Framework :: Django', | |
| 45 | + 'Intended Audience :: Developers', | |
| 46 | + 'Operating System :: OS Independent', | |
| 47 | + 'Programming Language :: Python', | |
| 48 | + 'Programming Language :: Python :: 2', | |
| 49 | + 'Programming Language :: Python :: 2.7', | |
| 50 | + 'Topic :: Internet :: WWW/HTTP', | |
| 51 | + 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', | |
| 52 | + 'Topic :: Internet :: WWW/HTTP :: WSGI', | |
| 53 | + ], | |
| 47 | 54 | ) | ... | ... |
| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | +SECRET_KEY = 'ddddddddddddddddddddddddddddddddddddddddddddddddddddddaddddddddd' | |
| 2 | + | |
| 3 | +DATABASES = { | |
| 4 | + 'default': { | |
| 5 | + 'ENGINE': 'django.db.backends.postgresql_psycopg2', | |
| 6 | + 'HOST': 'localhost', | |
| 7 | + 'NAME': 'colab', | |
| 8 | + 'USER': 'colab', | |
| 9 | + 'PASSWORD': 'colab', | |
| 10 | + } | |
| 11 | +} | ... | ... |
| ... | ... | @@ -0,0 +1,23 @@ |
| 1 | +from django.utils.translation import ugettext_lazy as _ | |
| 2 | +from colab.plugins.utils.menu import colab_url_factory | |
| 3 | + | |
| 4 | +name = 'colab_gitlab' | |
| 5 | +verbose_name = 'Gitlab Proxy' | |
| 6 | + | |
| 7 | +upstream = 'localhost' | |
| 8 | +#middlewares = [] | |
| 9 | + | |
| 10 | +urls = { | |
| 11 | + 'include': 'colab_gitlab.urls', | |
| 12 | + 'namespace': 'gitlab', | |
| 13 | + 'prefix': 'gitlab', | |
| 14 | +} | |
| 15 | + | |
| 16 | +menu_title = _('Code') | |
| 17 | + | |
| 18 | +url = colab_url_factory('gitlab') | |
| 19 | + | |
| 20 | +menu_urls = ( | |
| 21 | + url(display=_('Profile'), viewname='gitlab', kwargs={'path': '/profile/anonymous'}, auth=False), | |
| 22 | + url(display=_('Profile Two'), viewname='gitlab', kwargs={'path': '/profile/logged'}, auth=True), | |
| 23 | +) | ... | ... |
| ... | ... | @@ -0,0 +1,37 @@ |
| 1 | +#!/usr/bin/env python | |
| 2 | + | |
| 3 | +import os | |
| 4 | +import sys | |
| 5 | + | |
| 6 | +os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings' | |
| 7 | +os.environ['COLAB_SETTINGS'] = 'tests/config_settings.py' | |
| 8 | +os.environ['COLAB_YAML_SETTINGS'] = 'tests/settings.yaml' | |
| 9 | +os.environ['COLAB_PLUGINS'] = 'tests/plugins.d' | |
| 10 | +os.environ['COVERAGE_PROCESS_START'] = '.coveragerc' | |
| 11 | +os.environ['REUSE_DB'] = '0' | |
| 12 | + | |
| 13 | +import django | |
| 14 | +import coverage | |
| 15 | + | |
| 16 | +from django.test.utils import get_runner | |
| 17 | +from django.conf import settings | |
| 18 | + | |
| 19 | + | |
| 20 | +def runtests(): | |
| 21 | + if django.VERSION >= (1, 7, 0): | |
| 22 | + django.setup() | |
| 23 | + | |
| 24 | + test_runner = get_runner(settings) | |
| 25 | + failures = test_runner(interactive=False, failfast=False).run_tests([]) | |
| 26 | + sys.exit(failures) | |
| 27 | + | |
| 28 | + | |
| 29 | +def run_with_coverage(): | |
| 30 | + if os.path.exists('.coverage'): | |
| 31 | + os.remove('.coverage') | |
| 32 | + coverage.process_startup() | |
| 33 | + runtests() | |
| 34 | + | |
| 35 | + | |
| 36 | +if __name__ == '__main__': | |
| 37 | + run_with_coverage() | ... | ... |
| ... | ... | @@ -0,0 +1,39 @@ |
| 1 | +from colab.settings import * # noqa | |
| 2 | + | |
| 3 | +SOCIAL_NETWORK_ENABLED = True | |
| 4 | +STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' | |
| 5 | + | |
| 6 | +LOGGING = { | |
| 7 | + 'version': 1, | |
| 8 | + | |
| 9 | + 'handlers': { | |
| 10 | + 'null': { | |
| 11 | + 'level': 'DEBUG', | |
| 12 | + 'class': 'logging.NullHandler', | |
| 13 | + }, | |
| 14 | + }, | |
| 15 | + | |
| 16 | + 'loggers': { | |
| 17 | + 'colab.mailman': { | |
| 18 | + 'handlers': ['null'], | |
| 19 | + 'propagate': False, | |
| 20 | + }, | |
| 21 | + 'haystack': { | |
| 22 | + 'handlers': ['null'], | |
| 23 | + 'propagate': False, | |
| 24 | + }, | |
| 25 | + 'pysolr': { | |
| 26 | + 'handlers': ['null'], | |
| 27 | + 'propagate': False, | |
| 28 | + }, | |
| 29 | + }, | |
| 30 | +} | |
| 31 | + | |
| 32 | +import os | |
| 33 | +HAYSTACK_CONNECTIONS = { | |
| 34 | + 'default': { | |
| 35 | + 'ENGINE': 'haystack.backends.solr_backend.SolrEngine', | |
| 36 | + 'URL': 'http://127.0.0.1:8983/solr' | |
| 37 | + }, | |
| 38 | +} | |
| 39 | + | ... | ... |