Merge "Changes tox to only run unit tests and moves unit tests to tests/unit."
diff --git a/patrole_tempest_plugin/tests/api/identity/v3/test_credentials_rbac.py b/patrole_tempest_plugin/tests/api/identity/v3/test_credentials_rbac.py
index 3428e7f..b1018cd 100644
--- a/patrole_tempest_plugin/tests/api/identity/v3/test_credentials_rbac.py
+++ b/patrole_tempest_plugin/tests/api/identity/v3/test_credentials_rbac.py
@@ -15,7 +15,7 @@
 
 from tempest.common.utils import data_utils
 from tempest.lib.common.utils import test_utils
-from tempest import test
+from tempest.lib import decorators
 
 from patrole_tempest_plugin import rbac_rule_validation
 from patrole_tempest_plugin.rbac_utils import rbac_utils
@@ -52,7 +52,7 @@
 
     @rbac_rule_validation.action(service="keystone",
                                  rule="identity:create_credential")
-    @test.idempotent_id('c1ab6d34-c59f-4ae1-bae9-bb3c1089b48e')
+    @decorators.idempotent_id('c1ab6d34-c59f-4ae1-bae9-bb3c1089b48e')
     def test_create_credential(self):
         """Create a Credential.
 
@@ -63,7 +63,7 @@
 
     @rbac_rule_validation.action(service="keystone",
                                  rule="identity:update_credential")
-    @test.idempotent_id('cfb05ce3-bffb-496e-a3c2-9515d730da63')
+    @decorators.idempotent_id('cfb05ce3-bffb-496e-a3c2-9515d730da63')
     def test_update_credential(self):
         """Update a Credential.
 
@@ -84,7 +84,7 @@
 
     @rbac_rule_validation.action(service="keystone",
                                  rule="identity:delete_credential")
-    @test.idempotent_id('87ab42af-8d41-401b-90df-21e72919fcde')
+    @decorators.idempotent_id('87ab42af-8d41-401b-90df-21e72919fcde')
     def test_delete_credential(self):
         """Delete a Credential.
 
@@ -97,7 +97,7 @@
 
     @rbac_rule_validation.action(service="keystone",
                                  rule="identity:get_credential")
-    @test.idempotent_id('1b6eeae6-f1e8-4cdf-8903-1c002b1fc271')
+    @decorators.idempotent_id('1b6eeae6-f1e8-4cdf-8903-1c002b1fc271')
     def test_show_credential(self):
         """Show/Get a Credential.
 
@@ -110,7 +110,7 @@
 
     @rbac_rule_validation.action(service="keystone",
                                  rule="identity:list_credentials")
-    @test.idempotent_id('3de303e2-12a7-4811-805a-f18906472038')
+    @decorators.idempotent_id('3de303e2-12a7-4811-805a-f18906472038')
     def test_list_credentials(self):
         """List all Credentials.
 
diff --git a/patrole_tempest_plugin/tests/api/identity/v3/test_services_rbac.py b/patrole_tempest_plugin/tests/api/identity/v3/test_services_rbac.py
index f5a0a3e..30ecb7b 100644
--- a/patrole_tempest_plugin/tests/api/identity/v3/test_services_rbac.py
+++ b/patrole_tempest_plugin/tests/api/identity/v3/test_services_rbac.py
@@ -15,7 +15,7 @@
 
 from tempest.common.utils import data_utils
 from tempest import config
-from tempest import test
+from tempest.lib import decorators
 
 from patrole_tempest_plugin import rbac_rule_validation
 from patrole_tempest_plugin.rbac_utils import rbac_utils
@@ -33,7 +33,7 @@
 
     @rbac_rule_validation.action(service="keystone",
                                  rule="identity:create_service")
-    @test.idempotent_id('9a4bb317-f0bb-4005-8df0-4b672885b7c8')
+    @decorators.idempotent_id('9a4bb317-f0bb-4005-8df0-4b672885b7c8')
     def test_create_service(self):
         """Create a service.
 
@@ -44,7 +44,7 @@
 
     @rbac_rule_validation.action(service="keystone",
                                  rule="identity:update_service")
-    @test.idempotent_id('b39447d1-2cf6-40e5-a899-46f287f2ecf0')
+    @decorators.idempotent_id('b39447d1-2cf6-40e5-a899-46f287f2ecf0')
     def test_update_service(self):
         """Update a service.
 
@@ -61,7 +61,7 @@
 
     @rbac_rule_validation.action(service="keystone",
                                  rule="identity:delete_service")
-    @test.idempotent_id('177b991a-438d-4bef-8e9f-9c6cc5a1c9e8')
+    @decorators.idempotent_id('177b991a-438d-4bef-8e9f-9c6cc5a1c9e8')
     def test_delete_service(self):
         """Delete a service.
 
@@ -74,7 +74,7 @@
 
     @rbac_rule_validation.action(service="keystone",
                                  rule="identity:get_service")
-    @test.idempotent_id('d89a9ac6-cd53-428d-84c0-5bc71f4a432d')
+    @decorators.idempotent_id('d89a9ac6-cd53-428d-84c0-5bc71f4a432d')
     def test_show_service(self):
         """Show/Get a service.
 
@@ -87,7 +87,7 @@
 
     @rbac_rule_validation.action(service="keystone",
                                  rule="identity:list_services")
-    @test.idempotent_id('706e6bea-3385-4718-919c-0b5121395806')
+    @decorators.idempotent_id('706e6bea-3385-4718-919c-0b5121395806')
     def test_list_services(self):
         """list all services.
 
diff --git a/tests/__init__.py b/patrole_tempest_plugin/tests/unit/__init__.py
similarity index 100%
rename from tests/__init__.py
rename to patrole_tempest_plugin/tests/unit/__init__.py
diff --git a/tests/base.py b/patrole_tempest_plugin/tests/unit/base.py
similarity index 100%
rename from tests/base.py
rename to patrole_tempest_plugin/tests/unit/base.py
diff --git a/tests/resources/admin_rbac_policy.json b/patrole_tempest_plugin/tests/unit/resources/admin_rbac_policy.json
similarity index 100%
rename from tests/resources/admin_rbac_policy.json
rename to patrole_tempest_plugin/tests/unit/resources/admin_rbac_policy.json
diff --git a/tests/resources/alt_admin_rbac_policy.json b/patrole_tempest_plugin/tests/unit/resources/alt_admin_rbac_policy.json
similarity index 100%
rename from tests/resources/alt_admin_rbac_policy.json
rename to patrole_tempest_plugin/tests/unit/resources/alt_admin_rbac_policy.json
diff --git a/tests/resources/custom_rbac_policy.json b/patrole_tempest_plugin/tests/unit/resources/custom_rbac_policy.json
similarity index 100%
rename from tests/resources/custom_rbac_policy.json
rename to patrole_tempest_plugin/tests/unit/resources/custom_rbac_policy.json
diff --git a/tests/resources/tenant_rbac_policy.json b/patrole_tempest_plugin/tests/unit/resources/tenant_rbac_policy.json
similarity index 100%
rename from tests/resources/tenant_rbac_policy.json
rename to patrole_tempest_plugin/tests/unit/resources/tenant_rbac_policy.json
diff --git a/tests/test_patrole.py b/patrole_tempest_plugin/tests/unit/test_patrole.py
similarity index 93%
rename from tests/test_patrole.py
rename to patrole_tempest_plugin/tests/unit/test_patrole.py
index d374e20..58aff05 100644
--- a/tests/test_patrole.py
+++ b/patrole_tempest_plugin/tests/unit/test_patrole.py
@@ -20,7 +20,7 @@
 Tests for `patrole` module.
 """
 
-from tests import base
+from patrole_tempest_plugin.tests.unit import base
 
 
 class TestPatrole(base.TestCase):
diff --git a/tests/test_rbac_policy_parser.py b/patrole_tempest_plugin/tests/unit/test_rbac_policy_parser.py
similarity index 100%
rename from tests/test_rbac_policy_parser.py
rename to patrole_tempest_plugin/tests/unit/test_rbac_policy_parser.py
diff --git a/tests/test_rbac_rule_validation.py b/patrole_tempest_plugin/tests/unit/test_rbac_rule_validation.py
similarity index 100%
rename from tests/test_rbac_rule_validation.py
rename to patrole_tempest_plugin/tests/unit/test_rbac_rule_validation.py
diff --git a/tests/test_rbac_utils.py b/patrole_tempest_plugin/tests/unit/test_rbac_utils.py
similarity index 100%
rename from tests/test_rbac_utils.py
rename to patrole_tempest_plugin/tests/unit/test_rbac_utils.py
diff --git a/test-whitelist.txt b/test-whitelist.txt
new file mode 100644
index 0000000..162992a
--- /dev/null
+++ b/test-whitelist.txt
@@ -0,0 +1 @@
+patrole_tempest_plugin.tests.unit.test*
diff --git a/tox.ini b/tox.ini
index 847adad..ba00222 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@
 [tox]
 minversion = 1.6
-envlist = py35,py27,pypy,pep8
+envlist = pep8,py35,py27
 skipsdist = True
 
 [testenv]
@@ -9,16 +9,20 @@
 setenv =
    VIRTUAL_ENV={envdir}
    PYTHONWARNINGS=default::DeprecationWarning
-passenv = OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_TEST_TIMEOUT OS_TEST_LOCK_PATH OS_TEST_PATH TEMPEST_CONFIG TEMPEST_CONFIG_DIR http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
-whitelist_externals = *
+passenv = OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_TEST_TIMEOUT OS_TEST_LOCK_PATH OS_TEST_PATH http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
+whitelist_externals = find
 deps = -r{toxinidir}/requirements.txt
        -r{toxinidir}/test-requirements.txt
 commands = 
     find . -type f -name "*.pyc" -delete
-    ostestr {posargs}
+    ostestr {posargs} --whitelist-file test-whitelist.txt
 
 [testenv:pep8]
 commands = flake8 {posargs}
+		   check-uuid
+
+[testenv:uuidgen]
+commands = check-uuid --fix
 
 [testenv:venv]
 commands = {posargs}