Commit 8f9a5615 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Remove test of deprec. method "_raise_for_status"

parent 1c5569cd
......@@ -192,8 +192,7 @@ class Config(RawConfigParser):
if gval and cval and (
gval.lower().strip('/') != cval.lower().strip('/')):
raise CLISyntaxError(
'Conflicting values for default %s' % (
term),
'Conflicting values for default %s' % (term),
importance=2, details=[
' global.%s: %s' % (term, gval),
' %s.%s.%s: %s' % (
......
# Copyright 2013 GRNET S.A. All rights reserved.
# Copyright 2013-2014 GRNET S.A. All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
......@@ -39,6 +39,7 @@ from tempfile import NamedTemporaryFile
from io import StringIO
from kamaki.cli.config import HEADER
from kamaki.cli import errors
def _2steps_gen(limit=2):
......@@ -197,10 +198,8 @@ class Config(TestCase):
with make_file(content2) as f:
_cnf = Config(path=f.name)
self.assertEqual([], _cnf.rescue_old_file(err=err))
self.assertEqual(
'... rescue global.url => cloud.default.url\n', err.getvalue())
self.assertEqual(sample, _cnf.get_cloud('default', 'url'))
self.assertRaises(
errors.CLISyntaxError, _cnf.rescue_old_file, err=err)
del _cnf
content3 = list(content0)
......@@ -209,12 +208,8 @@ class Config(TestCase):
with make_file(content3) as f:
_cnf = Config(path=f.name)
self.assertEqual([], _cnf.rescue_old_file(err=err))
self.assertEqual(
2 * '... rescue global.url => cloud.default.url\n',
err.getvalue())
self.assertEqual(
'http://example2.com', _cnf.get_cloud('default', 'url'))
self.assertRaises(
errors.CLISyntaxError, _cnf.rescue_old_file, err=err)
del _cnf
content4 = list(content0)
......@@ -259,7 +254,7 @@ class Config(TestCase):
with make_file([]) as f:
with make_log_file() as logf:
_cnf = Config(path=f.name)
self.assertEqual(0.9, _cnf.guess_version())
self.assertEqual(0.12, _cnf.guess_version())
exp = 'All heuristics failed, cannot decide\n'
logf.file.seek(- len(exp), 2)
self.assertEqual(exp, logf.read())
......@@ -269,10 +264,7 @@ class Config(TestCase):
with make_file(content0) as f:
with make_log_file() as logf:
_cnf = Config(path=f.name)
self.assertEqual(0.9, _cnf.guess_version())
exp = '... found cloud "demo"\n'
logf.seek(- len(exp), 2)
self.assertEqual(exp, logf.read())
self.assertEqual(0.10, _cnf.guess_version())
for term in ('url', 'token'):
content1 = list(content0)
......@@ -282,7 +274,7 @@ class Config(TestCase):
with make_log_file() as logf:
_cnf = Config(path=f.name)
self.assertEqual(0.8, _cnf.guess_version())
exp = '..... config file has an old global section\n'
exp = 'config file has an old global section\n'
logf.seek(- len(exp), 2)
self.assertEqual(exp, logf.read())
......
......@@ -351,24 +351,6 @@ class Client(TestCase):
self.client._watch_thread_limit(list())
self.assertEqual(exp_limit, self.client._thread_limit)
def test__raise_for_status(self):
r = FR()
for txt, sts_code, sts in (('err msg', 10, None), ('', 42, 'Err St')):
r.text, r.status_code, r.status = txt, sts_code, sts
try:
self.client._raise_for_status(r)
except self.CE as ce:
self.assertEqual('%s' % ce, '%s %s\n' % (sts or '', txt))
self.assertEqual(ce.status, sts_code)
for msg, sts_code in (('err msg', 32), ('', 42), ('an err', None)):
err = self.CE(msg, sts_code) if sts_code else Exception(msg)
try:
self.client._raise_for_status(err)
except self.CE as ce:
self.assertEqual('%s' % ce, '%s %s\n' % (sts_code or '', msg))
self.assertEqual(ce.status, sts_code or 0)
@patch('kamaki.clients.Client.set_header')
def test_set_header(self, SH):
for name, value, condition in product(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment