@@ -0,0 +1,2087 @@
+%22%22%22Test Object State Module%22%22%22%0A%0Aimport unittest%0Aimport ggrc.app  # noqa pylint: disable=unused-import%0Afrom ggrc.models import all_models%0A%0A%0Aclass TestStates(unittest.TestCase):%0A  %22%22%22Test Object State main Test Case class%22%22%22%0A%0A  def _assert_states(self, models, expected_states, default):%0A    # pylint: disable=no-self-use%0A    for model in all_models.all_models:%0A      if model.__name__ not in models:%0A        continue%0A%0A      assert hasattr(model, %22valid_statuses%22), %5C%0A          %22%7B%7D does not have valid_statuses%22.format(model.__name__)%0A%0A      assert set(model.valid_statuses()) == set(expected_states), %5C%0A          %22%7B%7D does not have expected states %7B%7D. Current states %7B%7D%22.format(%0A              model.__name__, ', '.join(expected_states),%0A              ', '.join(model.valid_statuses()))%0A%0A      assert model.default_status() == default, %5C%0A          %22%7B%7D does not have expected default status %7B%7D, but %7B%7D instead%22.format(%0A              model.__name__,%0A              default,%0A              model.default_status())%0A%0A  def test_basic_states(self):%0A    %22%22%22Test basic object states%22%22%22%0A    basic_states = ('Draft', 'Active', 'Deprecated')%0A    basic_state_objects = (%0A        'AccessGroup', 'Clause', 'Contract',%0A        'Control', 'DataAsset', 'Directive', 'Facility', 'Issue', 'Market',%0A        'Objective', 'OrgGroup', 'Policy', 'Process', 'Product', 'Program',%0A        'Project', 'Regulation', 'Risk', 'Section', 'Standard', 'System',%0A        'SystemOrProcess', 'Threat', 'Vendor')%0A    self._assert_states(basic_state_objects, basic_states, 'Draft')%0A%0A  def test_audit_states(self):%0A    %22%22%22Test states for Audit object%22%22%22%0A    audit_states = ('Planned', 'In Progress', 'Manager Review',%0A                    'Ready for External Review', 'Completed')%0A    self._assert_states(('Audit', ), audit_states, 'Planned')%0A%0A  def test_assignable_states(self):%0A    %22%22%22Test states for Assignable objects (Assessment)%22%22%22%0A    assignable_states = (%0A        'In Progress', 'Completed', 'Not Started', 'Verified',%0A        'Ready for Review')%0A    self._assert_states(('Assessment', ), assignable_states, 'Not Started')%0A

Add unit test for object state