def testSaveCollection(self): request = rf.post('/collection/', TEST_COLLECTION_POST_DATA) collection = forms.create_collection(request, collection="test-collection", submission="myCollection") # Validate the form to populate cleaned_data for the save function self.assertTrue(collection.is_valid()) # Try saving the form collection.save() # Verify the data was input correctly self.assertValidSave(data=TEST_COLLECTION_POST_DATA, submission="myCollection") # Test creation of another bound collection tied to a existing Submission request = rf.get('/') collection = forms.create_collection(request, collection="test-collection", submission="myCollection")
def testCollectionSlicing(self): # FIXME: these tests are incomplete request = rf.get('/') collection = forms.create_collection(request, collection="test-collection", submission="myCollection") # Should have a collection with length of 2 self.assertEqual(2, len(collection)) # Check __getitem__ returns just a DataForm self.assertEqual('PersonalInformationForm', str(collection[0].__class__.__name__)) collection = collection[0:1] self.assertEqual(1, len(collection))
def testCreateBoundCollection(self): request = rf.post('/collection/', TEST_COLLECTION_POST_DATA) collection = forms.create_collection(request, collection="test-collection", submission="myCollection")