-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from radiac/feature/django2.22
Add tests and fix lint
- Loading branch information
Showing
20 changed files
with
337 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,19 @@ | ||
__pycache__/ | ||
# Dev | ||
*.pyc | ||
django_conversate.egg-info | ||
__pycache__ | ||
node_modules | ||
|
||
# Test | ||
.coverage* | ||
htmlcov | ||
test_media | ||
|
||
# Example | ||
docker-compose.dev.yml | ||
example/db.sqlite3 | ||
node_modules/ | ||
|
||
# Build | ||
*.egg-info | ||
build | ||
dist | ||
docs/_build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
os: linux | ||
dist: xenial | ||
language: python | ||
install: | ||
- pip install --upgrade pip wheel setuptools | ||
- pip install --upgrade virtualenv tox | ||
script: | ||
- tox | ||
|
||
jobs: | ||
include: | ||
|
||
- python: '3.7' | ||
env: TOXENV=py37-django2.2 | ||
- python: '3.7' | ||
env: TOXENV=py37-django3.0 | ||
- python: '3.7' | ||
env: TOXENV=py37-django3.1 | ||
|
||
- python: '3.8' | ||
env: TOXENV=py38-django2.2 | ||
- python: '3.8' | ||
env: TOXENV=py38-django3.0 | ||
- python: '3.8' | ||
env: TOXENV=py38-django3.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
from django import template | ||
|
||
|
||
register = template.Library() | ||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
from . import views | ||
|
||
|
||
app_name = "conversate" | ||
|
||
urlpatterns = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# | ||
# Developer requirements | ||
# | ||
|
||
# Dev tools | ||
black | ||
flake8 | ||
isort | ||
pip-tools | ||
|
||
# Testing | ||
model_bakery | ||
pytest | ||
pytest-black | ||
pytest-cov | ||
pytest-django | ||
pytest-flake8 | ||
pytest-isort | ||
tox | ||
|
||
# Docs | ||
sphinx | ||
sphinx-autobuild | ||
|
||
# Project (setup.cfg) | ||
django-yaa-settings | ||
commonmark | ||
emoji |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# | ||
# This file is autogenerated by pip-compile | ||
# To update, run: | ||
# | ||
# pip-compile | ||
# | ||
alabaster==0.7.12 # via sphinx | ||
appdirs==1.4.4 # via black, virtualenv | ||
asgiref==3.2.10 # via django | ||
attrs==20.2.0 # via pytest | ||
babel==2.8.0 # via sphinx | ||
black==20.8b1 # via -r requirements.in, pytest-black | ||
certifi==2020.6.20 # via requests | ||
chardet==3.0.4 # via requests | ||
click==7.1.2 # via black, pip-tools | ||
commonmark==0.9.1 # via -r requirements.in | ||
coverage==5.2.1 # via pytest-cov | ||
distlib==0.3.1 # via virtualenv | ||
django-yaa-settings==1.1.0 # via -r requirements.in | ||
#django==3.1.1 # via model-bakery | ||
docutils==0.16 # via sphinx | ||
emoji==0.6.0 # via -r requirements.in | ||
filelock==3.0.12 # via tox, virtualenv | ||
flake8==3.8.3 # via -r requirements.in, pytest-flake8 | ||
idna==2.10 # via requests | ||
imagesize==1.2.0 # via sphinx | ||
iniconfig==1.0.1 # via pytest | ||
isort==5.5.2 # via -r requirements.in, pytest-isort | ||
jinja2==2.11.2 # via sphinx | ||
livereload==2.6.3 # via sphinx-autobuild | ||
markupsafe==1.1.1 # via jinja2 | ||
mccabe==0.6.1 # via flake8 | ||
model-bakery==1.1.1 # via -r requirements.in | ||
more-itertools==8.5.0 # via pytest | ||
mypy-extensions==0.4.3 # via black | ||
packaging==20.4 # via pytest, sphinx, tox | ||
pathspec==0.8.0 # via black | ||
pip-tools==5.3.1 # via -r requirements.in | ||
pluggy==0.13.1 # via pytest, tox | ||
py==1.9.0 # via pytest, tox | ||
pycodestyle==2.6.0 # via flake8 | ||
pyflakes==2.2.0 # via flake8 | ||
pygments==2.7.0 # via sphinx | ||
pyparsing==2.4.7 # via packaging | ||
pytest-black==0.3.11 # via -r requirements.in | ||
pytest-cov==2.10.1 # via -r requirements.in | ||
pytest-django==3.9.0 # via -r requirements.in | ||
pytest-flake8==1.0.6 # via -r requirements.in | ||
pytest-isort==1.2.0 # via -r requirements.in | ||
pytest==6.0.2 # via -r requirements.in, pytest-black, pytest-cov, pytest-django, pytest-flake8 | ||
pytz==2020.1 # via babel, django | ||
regex==2020.7.14 # via black | ||
requests==2.24.0 # via sphinx | ||
six==1.15.0 # via livereload, packaging, pip-tools, tox, virtualenv | ||
snowballstemmer==2.0.0 # via sphinx | ||
sphinx-autobuild==2020.9.1 # via -r requirements.in | ||
sphinx==3.2.1 # via -r requirements.in, sphinx-autobuild | ||
sphinxcontrib-applehelp==1.0.2 # via sphinx | ||
sphinxcontrib-devhelp==1.0.2 # via sphinx | ||
sphinxcontrib-htmlhelp==1.0.3 # via sphinx | ||
sphinxcontrib-jsmath==1.0.1 # via sphinx | ||
sphinxcontrib-qthelp==1.0.3 # via sphinx | ||
sphinxcontrib-serializinghtml==1.1.4 # via sphinx | ||
sqlparse==0.3.1 # via django | ||
toml==0.10.1 # via black, pytest, pytest-black, tox | ||
tornado==6.0.4 # via livereload | ||
tox==3.20.0 # via -r requirements.in | ||
typed-ast==1.4.1 # via black | ||
typing-extensions==3.7.4.3 # via black | ||
urllib3==1.25.10 # via requests | ||
virtualenv==20.0.31 # via tox | ||
|
||
# The following packages are considered to be unsafe in a requirements file: | ||
# pip | ||
# setuptools |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class ConversateConfig(AppConfig): | ||
name = "conversate" | ||
verbose_name = "Conversate" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
""" | ||
Django settings for testapp project. | ||
Generated by 'django-admin startproject' using Django 2.2.15. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/2.2/topics/settings/ | ||
For the full list of settings and their values, see | ||
https://docs.djangoproject.com/en/2.2/ref/settings/ | ||
""" | ||
|
||
import os | ||
|
||
|
||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | ||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
|
||
|
||
# Quick-start development settings - unsuitable for production | ||
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ | ||
|
||
# SECURITY WARNING: keep the secret key used in production secret! | ||
SECRET_KEY = "secret" | ||
|
||
# SECURITY WARNING: don't run with debug turned on in production! | ||
DEBUG = True | ||
|
||
ALLOWED_HOSTS = [] | ||
|
||
|
||
# Application definition | ||
|
||
INSTALLED_APPS = [ | ||
"django.contrib.admin", | ||
"django.contrib.auth", | ||
"django.contrib.contenttypes", | ||
"django.contrib.sessions", | ||
"django.contrib.messages", | ||
"django.contrib.staticfiles", | ||
"conversate", | ||
] | ||
|
||
MIDDLEWARE = [ | ||
"django.middleware.security.SecurityMiddleware", | ||
"django.contrib.sessions.middleware.SessionMiddleware", | ||
"django.middleware.common.CommonMiddleware", | ||
"django.middleware.csrf.CsrfViewMiddleware", | ||
"django.contrib.auth.middleware.AuthenticationMiddleware", | ||
"django.contrib.messages.middleware.MessageMiddleware", | ||
"django.middleware.clickjacking.XFrameOptionsMiddleware", | ||
] | ||
|
||
ROOT_URLCONF = "tests.urls" | ||
|
||
TEMPLATES = [ | ||
{ | ||
"BACKEND": "django.template.backends.django.DjangoTemplates", | ||
"DIRS": [], | ||
"APP_DIRS": True, | ||
"OPTIONS": { | ||
"context_processors": [ | ||
"django.template.context_processors.debug", | ||
"django.template.context_processors.request", | ||
"django.contrib.auth.context_processors.auth", | ||
"django.contrib.messages.context_processors.messages", | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
|
||
# Database | ||
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases | ||
|
||
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}} | ||
|
||
|
||
# Password validation | ||
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators | ||
|
||
AUTH_PASSWORD_VALIDATORS = [ | ||
{ | ||
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", | ||
}, | ||
{"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"}, | ||
{"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"}, | ||
{"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"}, | ||
] | ||
|
||
|
||
# Internationalization | ||
# https://docs.djangoproject.com/en/2.2/topics/i18n/ | ||
|
||
LANGUAGE_CODE = "en-us" | ||
|
||
TIME_ZONE = "UTC" | ||
|
||
USE_I18N = True | ||
|
||
USE_L10N = True | ||
|
||
USE_TZ = True | ||
|
||
MEDIA_ROOT = os.path.join(BASE_DIR, "test_media") | ||
MEDIA_URL = "/media/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from model_bakery import baker | ||
|
||
from conversate.models import Message, Room | ||
|
||
|
||
def test_message_render__emoji_markdown(admin_user): | ||
room = baker.make(Room, users=[admin_user]) | ||
msg = Message.objects.create(room=room, user=admin_user, content=":thumbsup: *em*") | ||
assert msg.render() == "<p>\U0001F44D <em>em</em></p>\n" |
Oops, something went wrong.