New tests skeleton and examples using pytest
Instructions (from the project root): 1. pip install -r requirements-devel.txt 2. py.testremotes/origin/enhancement/email-actions
parent
4bfea3567a
commit
d22cbb6538
|
@ -0,0 +1,2 @@
|
||||||
|
[pytest]
|
||||||
|
DJANGO_SETTINGS_MODULE = settings.testing
|
|
@ -0,0 +1,6 @@
|
||||||
|
-r requirements.txt
|
||||||
|
|
||||||
|
factory-boy==2.3.1
|
||||||
|
py==1.4.20
|
||||||
|
pytest==2.5.2
|
||||||
|
pytest-django==2.6.1
|
|
@ -0,0 +1,23 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import pytest
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
|
from rest_framework.reverse import reverse
|
||||||
|
|
||||||
|
from ..factories import DomainFactory
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.django_db
|
||||||
|
|
||||||
|
|
||||||
|
def setup_module(module):
|
||||||
|
module.patcher = mock.patch("taiga.domains.base.get_default_domain", DomainFactory.build)
|
||||||
|
module.patcher.start()
|
||||||
|
|
||||||
|
|
||||||
|
def teardown_module(module):
|
||||||
|
module.patcher.stop()
|
||||||
|
|
||||||
|
|
||||||
|
def test_respond_400_if_credentials_are_invalid(client):
|
||||||
|
response = client.post(reverse("auth-list"), {"username": "john", "password": "smith"})
|
||||||
|
assert response.status_code == 400
|
|
@ -0,0 +1,13 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import factory
|
||||||
|
|
||||||
|
from taiga.domains import models
|
||||||
|
|
||||||
|
|
||||||
|
class DomainFactory(factory.DjangoModelFactory):
|
||||||
|
FACTORY_FOR = models.Domain
|
||||||
|
|
||||||
|
public_register = False
|
||||||
|
scheme = None
|
||||||
|
name = "localhost"
|
||||||
|
domain = "localhost"
|
Loading…
Reference in New Issue