Skip to content

Instantly share code, notes, and snippets.

@missaugustina
Last active January 19, 2016 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save missaugustina/59d378bfe465690eed39 to your computer and use it in GitHub Desktop.
Save missaugustina/59d378bfe465690eed39 to your computer and use it in GitHub Desktop.
api_samples_test_base error on instantiation
CODE SNIPPET:
import mock
from nova import test
from nova.tests.functional import api_samples_test_base
class TestCompareResult(test.NoDBTestCase):
"""Provide test coverage for result comparison logic in functional tests"""
def getApiSampleTestBaseHelper(self):
return api_samples_test_base.ApiSampleTestBase('setUp')
def setUp(self):
super(TestCompareResult, self).setUp()
self.ast = self.getApiSampleTestBaseHelper()
self.ast.api_major_version = 'v2'
self.ast.compute = mock.MagicMock()
def test_bare_strings_match(self):
"""compare 2 bare strings that match"""
sample_data = u'foo'
response_data = u'foo'
result = self.ast._compare_result(subs=self.ast._get_regexes(),
expected=sample_data,
result=response_data,
result_str="Test")
CONSOLE:
Traceback (most recent call last):
File "/home/auggy/dev/openstack/nova/nova/tests/unit/api_samples_test_base/test_compare_result.py", line 44, in test_bare_strings_match
result = self.ast._compare_result(subs=self.ast._get_regexes(),
File "/home/auggy/dev/openstack/nova/nova/tests/functional/api_samples_test_base.py", line 355, in _get_regexes
'api_vers': self.api_major_version,
AttributeError: 'ApiSampleTestBase' object has no attribute 'api_major_version'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment