Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

Commit

Permalink
Merge a8d31b7 into fd0b1c8
Browse files Browse the repository at this point in the history
  • Loading branch information
Tlazypanda committed Nov 7, 2018
2 parents fd0b1c8 + a8d31b7 commit 2fd25c2
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 7 deletions.
17 changes: 15 additions & 2 deletions systers_portal/community/tests/test_forms.py
Expand Up @@ -54,6 +54,18 @@ def test_edit_community_form(self):
'slug': 'foo'}
form = RequestCommunityForm(data=invalid_data, user=self.user)
self.assertFalse(form.is_valid())
# Test if order is set to none
order_none_data = {'name': 'Bar', 'slug': 'bar', 'order': '',
'is_member': 'Yes', 'email': 'foo@bar.com', 'type_community': 'Other',
'community_channel': 'Existing Social Media Channels ',
'demographic_target_count': 'Foobarbar', 'purpose': 'foopurpose',
'is_avail_volunteer': 'Yes', 'count_avail_volunteer': '15',
'content_developer': 'foobar', 'selection_criteria': 'foobarbar',
'is_real_time': 'foofoobar'
}
form = EditCommunityRequestForm(
data=order_none_data, instance=self.community_request)
self.assertFalse(form.is_valid())
data = {'name': 'Bar', 'slug': 'bar', 'order': '1',
'is_member': 'Yes', 'email': 'foo@bar.com', 'type_community': 'Other',
'community_channel': 'Existing Social Media Channels ',
Expand All @@ -76,8 +88,9 @@ def test_edit_community_form(self):
data=data, instance=self.community_request)
self.assertFalse(form.is_valid())
# Test if slug of the request exists in Community
self.community.slug = "bar"
self.community.save()
self.community = Community.objects.create(name="FooBarComm", slug="bar",
order=2,
admin=self.systers_user)
form = EditCommunityRequestForm(
data=data, instance=self.community_request)
self.assertFalse(form.is_valid())
Expand Down
31 changes: 26 additions & 5 deletions systers_portal/meetup/tests/test_views.py
Expand Up @@ -2092,15 +2092,36 @@ def test_post_view(self):
'meetup_slug': 'foobar',
'distance': '',
'unit': ''}]})

data8 = {}
data8 = {'date': '2018-06-12'}
response = self.client.post(url, data8, format='json')
self.assertEqual(json.loads(response.content.decode('utf-8')),
{'search_results':
[{'date': '2018-09-16',
'meetup': 'Foo Bar Baz',
[{'date': '2018-06-12',
'meetup': 'Foo Baz',
'location': 'Foo Systers',
'location_slug': 'foo',
'meetup_slug': 'foo-bar-baz',
'meetup_slug': 'foobar',
'distance': '',
'unit': ''}]})
data9 = {'date': '2018-06-13'}
response = self.client.post(url, data9, format='json')
self.assertEqual(json.loads(response.content.decode('utf-8')),
{'search_results':
[{'date': '2018-06-13',
'meetup': 'Foob Baz',
'location': 'Foo Systers1',
'location_slug': 'foob',
'meetup_slug': 'foobarbaz',
'distance': '',
'unit': ''}]})
data10 = {'keyword': 'test', 'date': '2018-06-13'}
response = self.client.post(url, data10, format='json')
self.assertEqual(json.loads(response.content.decode('utf-8')),
{'search_results':
[{'date': '2018-06-13',
'meetup': 'Foob Baz',
'location': 'Foo Systers1',
'location_slug': 'foob',
'meetup_slug': 'foobarbaz',
'distance': '',
'unit': ''}]})

0 comments on commit 2fd25c2

Please sign in to comment.