1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-26 16:25:06 +03:00

fixing ad_hoc imports

flake8 fixes

Fix and add awx/api/tests

added fact tests

added proper xml reports for jenkins

added jenkins requirements and adjusted Makefile target
This commit is contained in:
Wayne Witzel III 2016-01-28 12:01:12 -05:00
parent 6eae492d28
commit 71a1547c3a
13 changed files with 26 additions and 19 deletions

View File

@ -25,3 +25,5 @@ exclude_lines =
ignore_errors = True
[xml]
output = ./reports/coverage.xml

View File

@ -155,7 +155,7 @@ endif
.PHONY: clean rebase push requirements requirements_dev requirements_jenkins \
real-requirements real-requirements_dev real-requirements_jenkins \
develop refresh adduser syncdb migrate dbchange dbshell runserver celeryd \
receiver test test_coverage coverage_html test_jenkins dev_build \
receiver test test_unit test_coverage coverage_html test_jenkins dev_build \
release_build release_clean sdist rpmtar mock-rpm mock-srpm rpm-sign \
build-ui sync-ui test-ui build-ui-for-coverage test-ui-for-coverage \
build-ui-for-browser-tests test-ui-debug jshint ngdocs \
@ -360,14 +360,14 @@ check: flake8 pep8 # pyflakes pylint
# Run all API unit tests.
test:
$(PYTHON) -m py.test awx/main/tests
py.test awx/main/tests awx/api/tests awx/fact/tests
test_unit:
$(PYTHON) -m py.test awx/main/tests/unit
py.test awx/main/tests/unit
# Run all API unit tests with coverage enabled.
test_coverage:
$(PYTHON) -m py.test --cov=awx awx/main/tests
py.test --cov=awx --cov-report=xml --junitxml=./reports/junit.xml awx/main/tests awx/api/tests awx/fact/tests
# Output test coverage as HTML (into htmlcov directory).
coverage_html:
@ -378,8 +378,8 @@ test_tox:
tox -v
# Run unit tests to produce output for Jenkins.
test_jenkins:
$(PYTHON) manage.py jenkins -v2 --enable-coverage --project-apps-tests
# Alias existing make target so old versions run against Jekins the same way
test_jenkins : test_coverage
# UI TASKS
# --------------------------------------

View File

@ -5,7 +5,7 @@ from django.conf import settings
from django.test import LiveServerTestCase
from django.test.utils import override_settings
from awx.main.tests.jobs import BaseJobTestMixin
from awx.main.tests.job_base import BaseJobTestMixin
@override_settings(CELERY_ALWAYS_EAGER=True,

View File

@ -470,3 +470,4 @@ class Credential(PasswordFieldsModel, CommonModelNameNotUnique):
if 'cloud' not in update_fields:
update_fields.append('cloud')
super(Credential, self).save(*args, **kwargs)

View File

@ -19,7 +19,11 @@ from crum import impersonate
from awx.main.utils import * # noqa
from awx.main.models import * # noqa
from awx.main.tests.base import BaseJobExecutionTest
from tasks import TEST_SSH_KEY_DATA, TEST_SSH_KEY_DATA_LOCKED, TEST_SSH_KEY_DATA_UNLOCK
from awx.main.tests.data.ssh import (
TEST_SSH_KEY_DATA,
TEST_SSH_KEY_DATA_LOCKED,
TEST_SSH_KEY_DATA_UNLOCK,
)
__all__ = ['RunAdHocCommandTest', 'AdHocCommandApiTest']

View File

@ -10,7 +10,7 @@ from django.core.urlresolvers import reverse
# AWX
from awx.main.models import * # noqa
from job_base import BaseJobTestMixin
from awx.main.tests.job_base import BaseJobTestMixin
import yaml
__all__ = ['JobTemplateLaunchTest', 'JobTemplateLaunchPasswordsTest']

View File

@ -11,7 +11,7 @@ from django.core.urlresolvers import reverse
# AWX
from awx.main.models import * # noqa
from awx.main.tests.base import BaseLiveServerTest
from job_base import BaseJobTestMixin
from awx.main.tests.job_base import BaseJobTestMixin
__all__ = ['JobRelaunchTest',]

View File

@ -22,7 +22,7 @@ import requests
# AWX
from awx.main.models import * # noqa
from job_base import BaseJobTestMixin
from awx.main.tests.job_base import BaseJobTestMixin
__all__ = ['JobTemplateTest', 'JobTest', 'JobTemplateCallbackTest', 'JobTransactionTest', 'JobTemplateSurveyTest']

View File

@ -11,7 +11,7 @@ from django.conf import settings
# AWX
from awx.main.models import * # noqa
from awx.main.tests.base import BaseLiveServerTest
from job_base import BaseJobTestMixin
from awx.main.tests.job_base import BaseJobTestMixin
__all__ = ['JobStartCancelTest',]

View File

@ -257,8 +257,8 @@ class BaseJobTestMixin(BaseTestMixin):
# Each user has his/her own set of credentials.
from awx.main.tests.data.ssh import (TEST_SSH_KEY_DATA,
TEST_SSH_KEY_DATA_LOCKED,
TEST_SSH_KEY_DATA_UNLOCK)
TEST_SSH_KEY_DATA_LOCKED,
TEST_SSH_KEY_DATA_UNLOCK)
self.cred_sue = self.user_sue.credentials.create(
username='sue',
password=TEST_SSH_KEY_DATA,

View File

@ -20,7 +20,6 @@ import tempfile
from rest_framework.exceptions import ParseError, PermissionDenied
from django.utils.encoding import smart_str
from django.core.urlresolvers import reverse
from django.core.exceptions import ValidationError
# PyCrypto
from Crypto.Cipher import AES

View File

@ -9,3 +9,7 @@ pylint
flake8
distribute==0.7.3
unittest2
pytest
pytest-cov
pytest-django
pytest-pythonpath

View File

@ -12,10 +12,7 @@ RUN echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-or
RUN apt-get update
RUN apt-get install -y openssh-server ansible mg vim tmux git mercurial subversion python-dev python-psycopg2 make postgresql-client libpq-dev nodejs python-psutil libxml2-dev libxslt-dev lib32z1-dev libsasl2-dev libldap2-dev libffi-dev libzmq-dev proot python-pip libxmlsec1-dev swig redis-server && rm -rf /var/lib/apt/lists/*
RUN pip install flake8
RUN pip install pytest
RUN pip install pytest-pythonpath
RUN pip install pytest-django
RUN pip install pytest-cov
RUN pip install pytest pytest-pythonpath pytest-django pytest-cov
RUN /usr/bin/ssh-keygen -q -t rsa -N "" -f /root/.ssh/id_rsa
RUN mkdir -p /etc/tower
RUN mkdir -p /data/db