mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-14 13:47:07 +03:00
Removed Hitch per #529
This commit is contained in:
parent
5517bdd1bc
commit
7dad5ac667
|
@ -6,6 +6,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
### Added
|
### Added
|
||||||
- Check to confirm that the user has a modern version of Cookiecutter. (@pydanny)
|
- Check to confirm that the user has a modern version of Cookiecutter. (@pydanny)
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
- Removed hitch per #529 (@pydanny)
|
||||||
|
|
||||||
### [2016-04-20]
|
### [2016-04-20]
|
||||||
### Changed
|
### Changed
|
||||||
- Default to today's date in cookiecutter.json. (@audreyr)
|
- Default to today's date in cookiecutter.json. (@audreyr)
|
||||||
|
|
|
@ -22,7 +22,6 @@ Features
|
||||||
* For Django 1.9
|
* For Django 1.9
|
||||||
* Renders Django projects with 100% starting test coverage
|
* Renders Django projects with 100% starting test coverage
|
||||||
* Twitter Bootstrap_ v4.0.0 - alpha_
|
* Twitter Bootstrap_ v4.0.0 - alpha_
|
||||||
* End-to-end via Hitch_
|
|
||||||
* AngularJS_
|
* AngularJS_
|
||||||
* 12-Factor_ based settings via django-environ_
|
* 12-Factor_ based settings via django-environ_
|
||||||
* Optimized development and production settings
|
* Optimized development and production settings
|
||||||
|
@ -50,7 +49,6 @@ Optional Integrations
|
||||||
* Integration with Opbeat_ for performance monitoring
|
* Integration with Opbeat_ for performance monitoring
|
||||||
|
|
||||||
.. _alpha: http://blog.getbootstrap.com/2015/08/19/bootstrap-4-alpha/
|
.. _alpha: http://blog.getbootstrap.com/2015/08/19/bootstrap-4-alpha/
|
||||||
.. _Hitch: https://github.com/hitchtest/hitchtest
|
|
||||||
.. _Bootstrap: https://github.com/twbs/bootstrap
|
.. _Bootstrap: https://github.com/twbs/bootstrap
|
||||||
.. _AngularJS: https://github.com/angular/angular.js
|
.. _AngularJS: https://github.com/angular/angular.js
|
||||||
.. _django-environ: https://github.com/joke2k/django-environ
|
.. _django-environ: https://github.com/joke2k/django-environ
|
||||||
|
|
3
{{cookiecutter.project_slug}}/.gitignore
vendored
3
{{cookiecutter.project_slug}}/.gitignore
vendored
|
@ -68,8 +68,5 @@ node_modules/
|
||||||
# User-uploaded media
|
# User-uploaded media
|
||||||
{{ cookiecutter.project_slug }}/media/
|
{{ cookiecutter.project_slug }}/media/
|
||||||
|
|
||||||
# Hitch directory
|
|
||||||
tests/.hitch
|
|
||||||
|
|
||||||
# MailHog binary
|
# MailHog binary
|
||||||
mailhog
|
mailhog
|
||||||
|
|
|
@ -13,9 +13,3 @@ python:
|
||||||
{% else %}
|
{% else %}
|
||||||
- "2.7"
|
- "2.7"
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
install:
|
|
||||||
- "pip install hitch"
|
|
||||||
- "cd tests"
|
|
||||||
- "hitch init"
|
|
||||||
script:
|
|
||||||
- "hitch test . --extra '{\"xvfb\":true, \"pause_on_failure\":false}'"
|
|
||||||
|
|
|
@ -110,30 +110,6 @@ You must set the DSN url in production.
|
||||||
It's time to write the code!!!
|
It's time to write the code!!!
|
||||||
|
|
||||||
|
|
||||||
Running end to end integration tests
|
|
||||||
------------------------------------
|
|
||||||
|
|
||||||
N.B. The integration tests will not run on Windows.
|
|
||||||
|
|
||||||
To install the test runner::
|
|
||||||
|
|
||||||
$ pip install hitch
|
|
||||||
|
|
||||||
To run the tests, enter the {{cookiecutter.project_slug}}/tests directory and run the following commands::
|
|
||||||
|
|
||||||
$ hitch init
|
|
||||||
|
|
||||||
Then run the stub test::
|
|
||||||
|
|
||||||
$ hitch test stub.test
|
|
||||||
|
|
||||||
This will download and compile python, postgres and redis and install all python requirements so the first time it runs it may take a while.
|
|
||||||
|
|
||||||
Subsequent test runs will be much quicker.
|
|
||||||
|
|
||||||
The testing framework runs Django, Celery (if enabled), Postgres, HitchSMTP (a mock SMTP server), Firefox/Selenium and Redis.
|
|
||||||
|
|
||||||
|
|
||||||
Deployment
|
Deployment
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
# Global settings for your hitch tests
|
|
||||||
|
|
||||||
failfast: true
|
|
||||||
xvfb: false
|
|
||||||
pause_on_success: false
|
|
||||||
pause_on_failure: false
|
|
||||||
startup_timeout: 45
|
|
||||||
shutdown_timeout: 5
|
|
||||||
environment_variables:
|
|
||||||
DATABASE_URL: postgres://{{cookiecutter.project_slug}}:password@127.0.0.1:15432/{{cookiecutter.project_slug}}
|
|
||||||
SECRET_KEY: cj5^uos4tfCdfghjkf5hq$9$(@-79^e9&x$3vyf#igvsfm4d=+
|
|
||||||
CELERY_BROKER_URL: redis://localhost:16379
|
|
||||||
DJANGO_EMAIL_BACKEND: django.core.mail.backends.smtp.EmailBackend
|
|
||||||
window_size:
|
|
||||||
width: 1024
|
|
||||||
height: 600
|
|
||||||
python_version: {% if cookiecutter.use_python2 == 'n' %}3.5.0{% else %}2.7.10{% endif %}
|
|
||||||
environment:
|
|
||||||
- approved_platforms:
|
|
||||||
- linux
|
|
||||||
- darwin
|
|
|
@ -1,4 +0,0 @@
|
||||||
{% raw %}{% for python_version in python_versions %}
|
|
||||||
{% block test scoped %}
|
|
||||||
{% endblock %}
|
|
||||||
{% endfor %}{% endraw %}
|
|
|
@ -1,15 +0,0 @@
|
||||||
# Continuous integration settings for your tests
|
|
||||||
#
|
|
||||||
# Run with : hitch test . --settings ci.settings
|
|
||||||
#
|
|
||||||
# * Does not stop test run on first failure.
|
|
||||||
# * Firefox is run headless.
|
|
||||||
# * Start up timeout is higher (CI machines are not always powerful)
|
|
||||||
|
|
||||||
failfast: false
|
|
||||||
xvfb: true
|
|
||||||
startup_timeout: 60
|
|
||||||
|
|
||||||
# Comment out in Jenkins or other CI environments that don't print
|
|
||||||
# color characters correctly:
|
|
||||||
# colorless: true
|
|
|
@ -1,164 +0,0 @@
|
||||||
from subprocess import call
|
|
||||||
from os import path
|
|
||||||
import hitchpostgres
|
|
||||||
import hitchselenium
|
|
||||||
import hitchpython
|
|
||||||
import hitchserve
|
|
||||||
import hitchredis
|
|
||||||
import hitchtest
|
|
||||||
import hitchsmtp
|
|
||||||
|
|
||||||
|
|
||||||
# Get directory above this file
|
|
||||||
PROJECT_DIRECTORY = path.abspath(path.join(path.dirname(__file__), '..'))
|
|
||||||
|
|
||||||
|
|
||||||
class ExecutionEngine(hitchtest.ExecutionEngine):
|
|
||||||
"""Engine for orchestating and interacting with the app."""
|
|
||||||
|
|
||||||
def set_up(self):
|
|
||||||
"""Ensure virtualenv present, then run all services."""
|
|
||||||
python_package = hitchpython.PythonPackage(
|
|
||||||
python_version=self.settings['python_version']
|
|
||||||
)
|
|
||||||
python_package.build()
|
|
||||||
|
|
||||||
call([
|
|
||||||
python_package.pip, 'install', '-r',
|
|
||||||
path.join(PROJECT_DIRECTORY, 'requirements/local.txt')
|
|
||||||
])
|
|
||||||
|
|
||||||
postgres_package = hitchpostgres.PostgresPackage()
|
|
||||||
postgres_package.build()
|
|
||||||
|
|
||||||
redis_package = hitchredis.RedisPackage()
|
|
||||||
redis_package.build()
|
|
||||||
|
|
||||||
self.services = hitchserve.ServiceBundle(
|
|
||||||
project_directory=PROJECT_DIRECTORY,
|
|
||||||
startup_timeout=float(self.settings['startup_timeout']),
|
|
||||||
shutdown_timeout=float(self.settings['shutdown_timeout']),
|
|
||||||
)
|
|
||||||
|
|
||||||
postgres_user = hitchpostgres.PostgresUser('{{cookiecutter.project_slug}}', 'password')
|
|
||||||
|
|
||||||
self.services['Postgres'] = hitchpostgres.PostgresService(
|
|
||||||
postgres_package=postgres_package,
|
|
||||||
users=[postgres_user, ],
|
|
||||||
databases=[hitchpostgres.PostgresDatabase('{{cookiecutter.project_slug}}', postgres_user), ]
|
|
||||||
)
|
|
||||||
|
|
||||||
self.services['HitchSMTP'] = hitchsmtp.HitchSMTPService(port=1025)
|
|
||||||
|
|
||||||
self.services['Django'] = hitchpython.DjangoService(
|
|
||||||
python=python_package.python,
|
|
||||||
port=8000,
|
|
||||||
settings='config.settings.local',
|
|
||||||
needs=[self.services['Postgres'], ],
|
|
||||||
env_vars=self.settings['environment_variables'],
|
|
||||||
)
|
|
||||||
|
|
||||||
self.services['Redis'] = hitchredis.RedisService(
|
|
||||||
redis_package=redis_package,
|
|
||||||
port=16379,
|
|
||||||
)
|
|
||||||
{% if cookiecutter.use_celery == 'y' %}
|
|
||||||
self.services['Celery'] = hitchpython.CeleryService(
|
|
||||||
python=python_package.python,
|
|
||||||
app='{{cookiecutter.project_slug}}.taskapp', loglevel='INFO',
|
|
||||||
needs=[
|
|
||||||
self.services['Redis'], self.services['Django'],
|
|
||||||
],
|
|
||||||
env_vars=self.settings['environment_variables'],
|
|
||||||
)
|
|
||||||
{% endif %}
|
|
||||||
self.services['Firefox'] = hitchselenium.SeleniumService(
|
|
||||||
xvfb=self.settings.get('xvfb', False),
|
|
||||||
no_libfaketime=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
# import hitchcron
|
|
||||||
# self.services['Cron'] = hitchcron.CronService(
|
|
||||||
# run=self.services['Django'].manage("trigger").command,
|
|
||||||
# every=1,
|
|
||||||
# needs=[ self.services['Django'], ],
|
|
||||||
# )
|
|
||||||
|
|
||||||
self.services.startup(interactive=False)
|
|
||||||
|
|
||||||
# Docs : https://hitchtest.readthedocs.org/en/latest/plugins/hitchselenium.html
|
|
||||||
self.driver = self.services['Firefox'].driver
|
|
||||||
|
|
||||||
self.webapp = hitchselenium.SeleniumStepLibrary(
|
|
||||||
selenium_webdriver=self.driver,
|
|
||||||
wait_for_timeout=5,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add selenium steps
|
|
||||||
self.click = self.webapp.click
|
|
||||||
self.wait_to_appear = self.webapp.wait_to_appear
|
|
||||||
self.wait_to_contain = self.webapp.wait_to_contain
|
|
||||||
self.wait_for_any_to_contain = self.webapp.wait_for_any_to_contain
|
|
||||||
self.click_and_dont_wait_for_page_load = self.webapp.click_and_dont_wait_for_page_load
|
|
||||||
|
|
||||||
# Configure selenium driver
|
|
||||||
self.driver.set_window_size(self.settings['window_size']['width'], self.settings['window_size']['height'])
|
|
||||||
self.driver.set_window_position(0, 0)
|
|
||||||
self.driver.implicitly_wait(2.0)
|
|
||||||
self.driver.accept_next_alert = True
|
|
||||||
|
|
||||||
def pause(self, message=None):
|
|
||||||
"""Stop. IPython time."""
|
|
||||||
if hasattr(self, 'services'):
|
|
||||||
self.services.start_interactive_mode()
|
|
||||||
self.ipython(message)
|
|
||||||
if hasattr(self, 'services'):
|
|
||||||
self.services.stop_interactive_mode()
|
|
||||||
|
|
||||||
def load_website(self):
|
|
||||||
"""Navigate to website in Firefox."""
|
|
||||||
self.driver.get(self.services['Django'].url())
|
|
||||||
self.click('djHideToolBarButton')
|
|
||||||
|
|
||||||
def fill_form(self, **kwargs):
|
|
||||||
"""Fill in a form with id=value."""
|
|
||||||
for element, text in kwargs.items():
|
|
||||||
self.driver.find_element_by_id(element).send_keys(text)
|
|
||||||
|
|
||||||
def confirm_emails_sent(self, number):
|
|
||||||
"""Count number of emails sent by app."""
|
|
||||||
assert len(self.services['HitchSMTP'].logs.json()) == int(number)
|
|
||||||
|
|
||||||
def click_on_link_in_last_email(self, which=1):
|
|
||||||
"""Click on the nth link in the last email sent."""
|
|
||||||
self.driver.get(
|
|
||||||
self.services['HitchSMTP'].logs.json()[-1]['links'][which - 1]
|
|
||||||
)
|
|
||||||
|
|
||||||
def wait_for_email(self, containing=None):
|
|
||||||
"""Wait for, and return email."""
|
|
||||||
self.services['HitchSMTP'].logs.out.tail.until_json(
|
|
||||||
lambda email: containing in email['payload'] or containing in email['subject'],
|
|
||||||
timeout=25,
|
|
||||||
lines_back=1,
|
|
||||||
)
|
|
||||||
|
|
||||||
def time_travel(self, days=""):
|
|
||||||
"""Make all services think that time has skipped forward."""
|
|
||||||
self.services.time_travel(days=int(days))
|
|
||||||
|
|
||||||
def on_failure(self):
|
|
||||||
"""Stop and IPython."""
|
|
||||||
if not self.settings['quiet']:
|
|
||||||
if self.settings.get('pause_on_failure', False):
|
|
||||||
self.pause(message=self.stacktrace.to_template())
|
|
||||||
|
|
||||||
def on_success(self):
|
|
||||||
"""Pause on success if enabled."""
|
|
||||||
if self.settings.get('pause_on_success', False):
|
|
||||||
self.pause(message='SUCCESS')
|
|
||||||
|
|
||||||
def tear_down(self):
|
|
||||||
"""Shut down services required to run your test."""
|
|
||||||
if hasattr(self, 'services'):
|
|
||||||
self.services.shutdown()
|
|
|
@ -1,43 +0,0 @@
|
||||||
backports-abc==0.4
|
|
||||||
click==6.3
|
|
||||||
colorama==0.3.6
|
|
||||||
decorator==4.0.9
|
|
||||||
docopt==0.6.2
|
|
||||||
faketime==0.9.6.3
|
|
||||||
hitchcron==0.2
|
|
||||||
hitchpostgres==0.7.0
|
|
||||||
hitchpython==0.5.3
|
|
||||||
hitchredis==0.4.6
|
|
||||||
hitchselenium==0.5.1
|
|
||||||
hitchserve==0.4.9
|
|
||||||
hitchsmtp==0.2.1
|
|
||||||
hitchsystem==0.1.3
|
|
||||||
hitchtest==0.9.8
|
|
||||||
humanize==0.5.1
|
|
||||||
ipython==4.1.2
|
|
||||||
ipython-genutils==0.1.0
|
|
||||||
Jinja2==2.8
|
|
||||||
jupyter-client==4.2.0
|
|
||||||
jupyter-core==4.0.6
|
|
||||||
MarkupSafe==0.23
|
|
||||||
path.py==8.1.2
|
|
||||||
patool==1.12
|
|
||||||
pexpect==4.0.1
|
|
||||||
pickleshare==0.6
|
|
||||||
psutil==4.0.0
|
|
||||||
ptyprocess==0.5.1
|
|
||||||
pykwalify==1.5.0
|
|
||||||
python-build==0.2.13
|
|
||||||
python-dateutil==2.4.2
|
|
||||||
pyuv==1.2.0
|
|
||||||
PyYAML==3.11
|
|
||||||
pyzmq==15.2.0
|
|
||||||
requests==2.9.1
|
|
||||||
selenium==2.52.0
|
|
||||||
simplegeneric==0.8.1
|
|
||||||
six==1.10.0
|
|
||||||
tblib==1.2.0
|
|
||||||
tornado==4.3
|
|
||||||
traitlets==4.1.0
|
|
||||||
unixpackage==0.4.1
|
|
||||||
xeger==0.3
|
|
|
@ -1,18 +0,0 @@
|
||||||
- name: Sign up and log in
|
|
||||||
scenario:
|
|
||||||
- Load website
|
|
||||||
- Click: sign-up-link
|
|
||||||
- Fill form:
|
|
||||||
id_username: testuser
|
|
||||||
id_email: testuser@domain.com
|
|
||||||
id_password1: password
|
|
||||||
id_password2: password
|
|
||||||
- Click: sign-up-button
|
|
||||||
- Wait for email:
|
|
||||||
containing: Please Confirm Your E-mail Address
|
|
||||||
- Click on link in last email
|
|
||||||
- Click: confirm-button
|
|
||||||
- Fill form:
|
|
||||||
id_login: testuser
|
|
||||||
id_password: password
|
|
||||||
- Click: sign-in-button
|
|
|
@ -1,11 +0,0 @@
|
||||||
firefox
|
|
||||||
libpq-dev
|
|
||||||
llvm
|
|
||||||
graphviz-dev
|
|
||||||
libtiff-dev
|
|
||||||
libjpeg8-dev
|
|
||||||
libfreetype6-dev
|
|
||||||
liblcms-dev
|
|
||||||
libwebp-dev
|
|
||||||
zlib1g-dev
|
|
||||||
gettext
|
|
|
@ -1,9 +0,0 @@
|
||||||
# Test driven development settings
|
|
||||||
#
|
|
||||||
# Run with : hitch test . --settings tdd.settings
|
|
||||||
#
|
|
||||||
# Tests stop on first failure, pause and launch into IPython for debugging/interaction.
|
|
||||||
|
|
||||||
failfast: true
|
|
||||||
pause_on_failure: true
|
|
||||||
pause_on_success: true
|
|
|
@ -19,26 +19,5 @@ libfreetype6-dev
|
||||||
liblcms1-dev
|
liblcms1-dev
|
||||||
libwebp-dev
|
libwebp-dev
|
||||||
|
|
||||||
|
|
||||||
##django-extensions
|
##django-extensions
|
||||||
graphviz-dev
|
graphviz-dev
|
||||||
|
|
||||||
##hitch
|
|
||||||
python-setuptools
|
|
||||||
python3-dev
|
|
||||||
python-virtualenv
|
|
||||||
python-pip
|
|
||||||
firefox
|
|
||||||
automake
|
|
||||||
libtool
|
|
||||||
libreadline6
|
|
||||||
libreadline6-dev
|
|
||||||
libreadline-dev
|
|
||||||
libsqlite3-dev
|
|
||||||
libxml2
|
|
||||||
libxml2-dev
|
|
||||||
libssl-dev
|
|
||||||
libbz2-dev
|
|
||||||
wget
|
|
||||||
curl
|
|
||||||
llvm
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user