Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

Commit

Permalink
Add a new base cli test class
Browse files Browse the repository at this point in the history
This commit adds a new base test class for the cli testing framework.
This differs from the previous version in the tempest repo because it
uses an abstract method to initialize the client object. While in
tempest this was done inside the test class itself and leveraged the
config object.

Since the config object is being decoupled from the library defining
the test class this way allows any child test class to use whatever
credentials and previous config options directly in setup.
  • Loading branch information
mtreinish committed Aug 28, 2014
1 parent a745d09 commit 9936cde
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Babel>=1.3
fixtures>=0.3.14
oslo.config>=1.4.0.0a3
iso8601>=0.1.9
testresources>=0.2.4
13 changes: 12 additions & 1 deletion tempest_lib/cli/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import testtools

from tempest_lib import base
import tempest_lib.cli.output_parser
from tempest_lib import exceptions
from tempest_lib.openstack.common import log as logging
Expand Down Expand Up @@ -92,7 +93,6 @@ class CLIClientBase(object):
def __init__(self, username='', password='', tenant_name='', uri='',
cli_dir='', *args, **kwargs):
super(CLIClientBase, self).__init__()
self.parser = tempest_lib.cli.output_parser
self.cli_dir = cli_dir if cli_dir else '/usr/bin'
self.username = username
self.tenant_name = tenant_name
Expand Down Expand Up @@ -190,3 +190,14 @@ def assertFirstLineStartsWith(self, lines, beginning):
self.assertTrue(lines[0].startswith(beginning),
msg=('Beginning of first line has invalid content: %s'
% lines[:3]))


class ClientTestBase(base.BaseTestCase):

def setUp(self):
super(ClientTestBase, self).setUp()
self.clients = self._get_clients()
self.parser = tempest_lib.cli.output_parser

def _get_clients(self):
raise NotImplementedError

0 comments on commit 9936cde

Please sign in to comment.