def test_get_attributes(self, role_name, object_type): """Test get all attributes json""" factories.AccessControlRoleFactory(name=role_name, object_type=object_type) all_attrs_str = get_all_attributes_json(load_custom_attributes=True) all_attrs = json.loads(all_attrs_str) all_attrs_for_type = all_attrs[object_type] self.assertIn(role_name, (x["attr_name"] for x in all_attrs_for_type))
def test_get_attributes(self, role_name, object_type): """Test get all attributes json""" factories.AccessControlRoleFactory( name=role_name, object_type=object_type ) all_attrs_str = get_all_attributes_json(load_custom_attributes=True) all_attrs = json.loads(all_attrs_str) all_attrs_for_type = all_attrs[object_type] self.assertIn(role_name, (x["attr_name"] for x in all_attrs_for_type))
def test_get_all_attributes_cads(self): """Test get all attributes json with cads.""" cad = factories.CustomAttributeDefinitionFactory( title="cad text", definition_type="control", attribute_type="Text", ) ext_cad = factories.ExternalCustomAttributeDefinitionFactory( title="ext cad text", definition_type="control", attribute_type="Text", ) attrs_str = get_all_attributes_json(load_custom_attributes=True) attrs_json = json.loads(attrs_str) attrs_by_type = attrs_json["Control"] attrs = (attr["attr_name"] for attr in attrs_by_type) self.assertIn(ext_cad.title, attrs) self.assertNotIn(cad.title, attrs)
def test_export_system_attributes(self): """Test that Read-only flag is not show on export page.""" export_attributes = views.get_all_attributes_json() self.assertNotIn("Read-only", export_attributes) self.assertNotIn("readonly", export_attributes) self.assertNotIn("hidden", export_attributes)
def test_export_system_attributes(self): """Test that Read-only flag is not show on export page.""" export_attributes = views.get_all_attributes_json() self.assertNotIn("Read-only", export_attributes) self.assertNotIn("readonly", export_attributes) self.assertNotIn("hidden", export_attributes)