def setup(self): """ Set up the unit test suite. .. versionadded:: 0.2.0 .. note:: We just use strings to represent the label objects, for simplified testing code. """ self.labels = {'LabelA': 'labelA', 'LabelB': 'labelB'} self.mock = MockAssetObject('mock_container', self.labels)
class TestMockAssetObject(object): """ Nose unit test suite for Probe's Tank MockAssetObject. .. versionadded:: 0.2.0 """ def setup(self): """ Set up the unit test suite. .. versionadded:: 0.2.0 .. note:: We just use strings to represent the label objects, for simplified testing code. """ self.labels = {'LabelA': 'labelA', 'LabelB': 'labelB'} self.mock = MockAssetObject('mock_container', self.labels) def teardown(self): """ Tear down the unit test suite. .. versionadded:: 0.2.0 """ pass def test_init(self): """ Verify that the mock asset object is initialised as expected. .. versionadded:: 0.2.0 .. versionchanged:: 0.12.0 Added a simple test to confirm that the asset properties field is present. """ assert_true(self.mock.container == 'mock_container') assert_true(self.mock.labels.labels == self.labels) assert_true(self.mock.system.name == 'test_name') assert_true(self.mock.system.type_name == 'test_type') assert_true(self.mock.properties != None) def test_save(self): """ Verify that the mock revision has a save() method. .. versionadded:: 0.12.0 """ assert_true(hasattr(self.mock, 'save')) def test_repr(self): """ Test that the mock asset object repr method works correctly. .. versionadded:: 0.2.0 """ assert_true(self.mock.__repr__() == 'mock_container')