Пример #1
0
    def test_getFromClass_getData(self, mock_get):
        collectionEditView = views.CollectionEditView()
        collectionEditView.request = FakeRequest()
        collectionEditView.kwargs = {
            'org': 'testOrgId',
        }

        collectionForm = collectionEditView.get_form_class()
        self.assertEquals(collectionForm.__name__, 'CollectionEditForm')
Пример #2
0
 def test_getContextForOrgCol_contextForOrgReceived(self, mock_get):
     colResponse = MagicMock(spec=Response)
     colResponse.json.return_value = "testOrg"
     mock_get.return_value = colResponse
     collectionEditView = views.CollectionEditView()
     collectionEditView.request = FakeRequest()
     collectionEditView.collection = {'id': 'mycolid'}
     collectionEditView.kwargs = {
         'org': 'testOrgId',
     }
     context = collectionEditView.get_context_data();
     self.assertEquals(context['org'], "testOrg")
     self.assertIsNone(context['ocl_user'])
     self.assertFalse(context['from_user'])
     self.assertTrue(context['from_org'])