#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

from __future__ import absolute_import, division, print_function
__metaclass__ = type

from .lib.common import BASE_DIR

from invoke import task


@task(name='sanity-all')
def sanity_all_(c):
    cmds = [
        'bash {0}/test/ansible/sanity/correct-defaultdict-import.sh'.format(BASE_DIR),
        'bash {0}/test/ansible/sanity/correct-iteritems-import.sh'.format(BASE_DIR),
        'bash {0}/test/ansible/sanity/incorrect-comparisons.sh'.format(BASE_DIR),
        'bash {0}/test/ansible/sanity/integration-test-idempotent-names.sh'.format(BASE_DIR),
        'bash {0}/test/ansible/sanity/q-debugging-exists.sh'.format(BASE_DIR),
        'python {0}/test/ansible/sanity/f5-sdk-install-missing-code-highlighting.py'.format(BASE_DIR),
        'python {0}/test/ansible/sanity/short-description-ends-with-period.py'.format(BASE_DIR),
    ]

    for cmd in cmds:
        c.run(cmd, pty=True)


@task
def unit(c):
    c.run("pytest -s {0}/test/".format(BASE_DIR))


@task
def style(c):
    c.run("pycodestyle {0}".format(BASE_DIR))

@@ -255,16 +255,51 @@
 = type%0A%0A
+from .lib.common import CONFIG_DIR%0A
 from .li
@@ -1211,28 +1211,576 @@
 tyle %7B0%7D%22.format(BASE_DIR))%0A
+%0A%0A@task%0Adef functional(c, module):%0A    cmd = %5B%0A        'docker-compose',%0A        '--file', '%7B0%7D/devtools/docker-compose.yaml'.format(BASE_DIR),%0A        '--file %7B0%7D/docker-compose.site.yaml'.format(CONFIG_DIR),%0A        'run',%0A        'py3.6',%0A        'inv test.functional-internal',%0A        '-m %7B0%7D'.format(module)%0A    %5D%0A    c.run(' '.join(cmd), pty=True)%0A%0A%0A@task%0Adef functional_internal(c, module):%0A    with c.cd(%22%7B0%7D/test/integration%22.format(BASE_DIR)):%0A        c.run(%22ansible-playbook -i inventory/hosts %7B0%7D.yaml -vvvv%22.format(module), pty=True)%0A

add integration test short command