def setup(self): """ Set up the unit test suite. .. versionadded:: 0.2.0 .. versionchanged:: 0.7.0 Added test data for is_locked property. .. note:: We just use strings for property contents etc, in order to simplify unit test code. """ self.properties = { 'contents': ['RevisionA', 'RevisionB'], 'pipeline_data': { 'cat': True, 'hat': False }, 'is_locked': False } self.mock = MockProperties(self.properties)
def setup(self): """ Set up the unit test suite. .. versionadded:: 0.2.0 .. versionchanged:: 0.7.0 Added test data for is_locked property. .. note:: We just use strings for property contents etc, in order to simplify unit test code. """ self.properties = {'contents': ['RevisionA', 'RevisionB'], 'pipeline_data': {'cat': True, 'hat':False}, 'is_locked': False} self.mock = MockProperties(self.properties)
class TestMockProperties(object): """ Nose unit test suite for Probe's Tank MockProperties. .. versionadded:: 0.2.0 """ def setup(self): """ Set up the unit test suite. .. versionadded:: 0.2.0 .. versionchanged:: 0.7.0 Added test data for is_locked property. .. note:: We just use strings for property contents etc, in order to simplify unit test code. """ self.properties = { 'contents': ['RevisionA', 'RevisionB'], 'pipeline_data': { 'cat': True, 'hat': False }, 'is_locked': False } self.mock = MockProperties(self.properties) def teardown(self): """ Tear down the unit test suite. .. versionadded:: 0.2.0 """ pass def test_init(self): """ Verify that the mock properties is initialised as expected. .. versionadded:: 0.2.0 """ assert_true(self.mock.properties == self.properties) def test_contents(self): """ Test that the contents property returns the expected result. .. versionadded:: 0.2.0 """ assert_true(self.mock.contents == self.properties['contents']) def test_pipeline_data(self): """ Test that the pipeline data property returns the expected result. .. versionadded:: 0.2.0 """ assert_true( self.mock.pipeline_data == self.properties['pipeline_data']) def test_is_locked(self): """ Test that the is locked property returns the expected result. .. versionadded:: 0.7.0 """ assert_true(self.mock.is_locked == self.properties['is_locked']) # make sure we can set a value on it self.mock.is_locked = True assert_true(self.mock.is_locked) def test_keys(self): """ Confirm that the expected property keys are returned. .. versionadded:: 0.2.0 .. versionchanged:: 0.7.0 Increment the number of expected keys by 1, added a check for is_locked. """ assert_true(len(self.mock.keys()) == 3) assert_true('contents' in self.mock.keys()) assert_true('pipeline_data' in self.mock.keys()) assert_true('is_locked' in self.mock.keys())
class TestMockProperties(object): """ Nose unit test suite for Probe's Tank MockProperties. .. versionadded:: 0.2.0 """ def setup(self): """ Set up the unit test suite. .. versionadded:: 0.2.0 .. versionchanged:: 0.7.0 Added test data for is_locked property. .. note:: We just use strings for property contents etc, in order to simplify unit test code. """ self.properties = {'contents': ['RevisionA', 'RevisionB'], 'pipeline_data': {'cat': True, 'hat':False}, 'is_locked': False} self.mock = MockProperties(self.properties) def teardown(self): """ Tear down the unit test suite. .. versionadded:: 0.2.0 """ pass def test_init(self): """ Verify that the mock properties is initialised as expected. .. versionadded:: 0.2.0 """ assert_true(self.mock.properties == self.properties) def test_contents(self): """ Test that the contents property returns the expected result. .. versionadded:: 0.2.0 """ assert_true(self.mock.contents == self.properties['contents']) def test_pipeline_data(self): """ Test that the pipeline data property returns the expected result. .. versionadded:: 0.2.0 """ assert_true(self.mock.pipeline_data == self.properties['pipeline_data']) def test_is_locked(self): """ Test that the is locked property returns the expected result. .. versionadded:: 0.7.0 """ assert_true(self.mock.is_locked == self.properties['is_locked']) # make sure we can set a value on it self.mock.is_locked = True assert_true(self.mock.is_locked) def test_keys(self): """ Confirm that the expected property keys are returned. .. versionadded:: 0.2.0 .. versionchanged:: 0.7.0 Increment the number of expected keys by 1, added a check for is_locked. """ assert_true(len(self.mock.keys()) == 3) assert_true('contents' in self.mock.keys()) assert_true('pipeline_data' in self.mock.keys()) assert_true('is_locked' in self.mock.keys())