Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
lifenautjoe committed May 3, 2020
2 parents 624d588 + 57b566e commit 09cc5eb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion openbook_auth/checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def check_community_data(user, community, name=None, cover=None, avatar=None, ty

def check_community_type_can_be_updated(type, community):
Community = get_community_model()
if type == Community.COMMUNITY_TYPE_PUBLIC and community.is_private:
if type == Community.COMMUNITY_TYPE_PUBLIC and community.is_private():
raise ValidationError(
_('A community cannot be changed from private to public'),
)
Expand Down
25 changes: 25 additions & 0 deletions openbook_communities/tests/views/community/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,31 @@ def test_can_update_administrated_community_description(self):

self.assertEqual(community.description, new_community_description)

def test_can_update_administrated_community_description_with_type_unchanged(self):
"""
should be able to update an administrated community description with the same type
"""
user = make_user()
headers = make_authentication_headers_for_user(user)

community = make_community(creator=user)
new_community_description = make_community_description()

data = {
'description': new_community_description,
'type': 'P'
}

url = self._get_url(community_name=community.name)

response = self.client.patch(url, data, **headers)

self.assertEqual(response.status_code, status.HTTP_200_OK)

community.refresh_from_db()

self.assertEqual(community.description, new_community_description)

def test_can_update_administrated_community_rules(self):
"""
should be able to update an administrated community rules
Expand Down

0 comments on commit 09cc5eb

Please sign in to comment.