Merge "Cleanup integration tests setup"

This commit is contained in:
Jenkins 2016-07-13 22:43:28 +00:00 committed by Gerrit Code Review
commit 45b97743fd
7 changed files with 6 additions and 95 deletions

View File

@ -25,7 +25,7 @@ setenv = {[testenv]setenv}
setenv = {[testenv]setenv}
ZAQAR_TEST_INTEGRATION=1
OS_TEST_PATH=./zaqar/tests/functional
commands = python setup.py testr --slowest --testr-args='--concurrency 1'
commands = python setup.py testr --slowest --testr-args='--concurrency 1 {posargs}'
[testenv:pep8]
commands = flake8

View File

@ -2,14 +2,7 @@
# run_tests = True
unreliable = True
[auth]
# auth_on = False
# url = https://127.0.0.1:5000/v2.0/tokens
# username = None
# password = None
[zaqar]
# run_server = True
# url = http://0.0.0.0:8888
# config = functional-zaqar.conf

View File

@ -95,11 +95,6 @@ class FunctionalTestBase(testing.TestBase):
self.__class__.class_ttl_gc_interval = 60
if _TEST_INTEGRATION:
# TODO(kgriffs): This code should be replaced to use
# an external wsgi server instance.
# NOTE(flaper87): Use running instances.
if self.cfg.zaqar.run_server:
if not (self.server and self.server.is_alive()):
self.server = self.server_class()
self.server.start(self.mconf)
@ -117,10 +112,6 @@ class FunctionalTestBase(testing.TestBase):
self.headers = helpers.create_zaqar_headers(self.cfg)
if self.cfg.auth.auth_on:
auth_token = helpers.get_keystone_token(self.cfg, self.client)
self.headers["X-Auth-Token"] = auth_token
self.headers_response_with_body = {'location', 'content-type'}
self.client.set_headers(self.headers)

View File

@ -23,16 +23,8 @@ _DEFAULT = (
cfg.BoolOpt("run_tests", default=True),
)
_AUTH_OPTIONS = (
cfg.BoolOpt("auth_on", default=False),
cfg.StrOpt("url", default="https://127.0.0.1:5000/v2.0/tokens"),
cfg.StrOpt("username"),
cfg.StrOpt("password"),
)
_ZAQAR_OPTIONS = (
cfg.BoolOpt("run_server", default=True),
cfg.StrOpt("url", default="http://127.0.0.1:8888"),
cfg.StrOpt("config", default="functional-zaqar.conf"),
)
@ -47,7 +39,6 @@ _HEADERS_OPTIONS = (
def load_config():
conf = cfg.ConfigOpts()
conf.register_opts(_DEFAULT)
conf.register_opts(_AUTH_OPTIONS, group="auth")
conf.register_opts(_ZAQAR_OPTIONS, group="zaqar")
conf.register_opts(_HEADERS_OPTIONS, group="headers")

View File

@ -18,28 +18,6 @@ import string
import uuid
def get_keystone_token(conf, client):
"""Gets Keystone Auth token."""
body = {
'auth': {
'passwordCredentials': {
'username': conf.auth.username,
'password': conf.auth.password
},
},
}
header = {"Content-Type": "application/json",
"Accept": "application/json"}
response = client.post(url=conf.auth.url,
headers=header,
data=body)
response_body = response.json()
return response_body['access']['token']['id']
def create_zaqar_headers(conf):
"""Returns headers to be used for all Zaqar requests."""

View File

@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import copy
import uuid
import ddt
@ -125,26 +124,6 @@ class TestInsertQueue(base.V1FunctionalTestBase):
test_insert_queue_invalid_name.tags = ['negative']
def test_insert_queue_invalid_authtoken(self):
"""Insert Queue with invalid authtoken."""
# NOTE(flaper87): Currently, tearDown
# depends on this attribute. Needs to
# be fixed.
self.url = self.base_url + '/queues/invalidauthtoken'
self.addCleanup(self.client.delete, self.url)
if not self.cfg.auth.auth_on:
self.skipTest("Auth is not on!")
header = copy.copy(self.header)
header['X-Auth-Token'] = 'invalid'
result = self.client.put(self.url, headers=header)
self.assertEqual(401, result.status_code)
test_insert_queue_invalid_authtoken.tags = ['negative']
def test_insert_queue_header_plaintext(self):
"""Insert Queue with 'Accept': 'plain/text'."""
path = '/queues/plaintextheader'

View File

@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import copy
import uuid
import ddt
@ -116,26 +115,6 @@ class TestInsertQueue(base.V1_1FunctionalTestBase):
test_insert_queue_invalid_name.tags = ['negative']
def test_insert_queue_invalid_authtoken(self):
"""Insert Queue with invalid authtoken."""
# NOTE(flaper87): Currently, tearDown
# depends on this attribute. Needs to
# be fixed.
self.url = self.base_url + '/queues/invalidauthtoken'
self.addCleanup(self.client.delete, self.url)
if not self.cfg.auth.auth_on:
self.skipTest("Auth is not on!")
header = copy.copy(self.header)
header['X-Auth-Token'] = 'invalid'
result = self.client.put(self.url, headers=header)
self.assertEqual(401, result.status_code)
test_insert_queue_invalid_authtoken.tags = ['negative']
def test_insert_queue_header_plaintext(self):
"""Insert Queue with 'Accept': 'plain/text'."""
path = '/queues/plaintextheader'