def test_when_defaultLocale_is_not_provided_then_form_is_not_valid(self): form_data = { 'name': 'col', 'full_name': 'collection', 'collection_type': 'Dictionary', 'public_access': 'Edit', 'supported_locales': 'en' } form = CollectionCreateForm(data=form_data) self.assertFalse(form.is_valid())
def test_when_all_valid_data_is_provided_then_new_collection_should_be_made( self): form_data = { 'short_code': 'col', 'name': 'col', 'full_name': 'collection', 'collection_type': 'Dictionary', 'public_access': 'Edit', 'default_locale': 'en', 'supported_locales': 'en' } form = CollectionCreateForm(data=form_data) self.assertTrue(form.is_valid())
def test_when_all_valid_data_is_provided_then_new_collection_should_be_made( self, mock_get): form_data = { 'short_code': 'col', 'name': 'col', 'full_name': 'collection', 'collection_type': 'Dictionary', 'public_access': 'Edit', 'default_locale': 'en', 'supported_locales': 'en' } response = Response() response.json = lambda: [{'locale': 'en', 'display_name': 'en'}] mock_get.return_value = response form = CollectionCreateForm(data=form_data) self.assertTrue(form.is_valid())