Revision 37d59b27 snf-astakos-app/astakos/im/tests.py

b/snf-astakos-app/astakos/im/tests.py
1206 1206
                                                      api_url="/astakos/api/")
1207 1207
        self.resource = Resource.objects.create(name="astakos.pending_app",
1208 1208
                                                uplimit=0,
1209
                                                allow_in_projects=False,
1209 1210
                                                service=self.astakos_service)
1210 1211

  
1211 1212
        # custom service resources
......
1241 1242
        self.assertRedirects(r, reverse('project_add'))
1242 1243

  
1243 1244
    @im_settings(PROJECT_ADMINS=['uuid1'])
1245
    def test_allow_in_project(self):
1246
        dfrom = datetime.now()
1247
        dto = datetime.now() + timedelta(days=30)
1248

  
1249
        # astakos.pending_uplimit allow_in_project flag is False
1250
        # we shouldn't be able to create a project application using this
1251
        # resource.
1252
        application_data = {
1253
            'name': 'project.synnefo.org',
1254
            'homepage': 'https://www.synnefo.org',
1255
            'start_date': dfrom.strftime("%Y-%m-%d"),
1256
            'end_date': dto.strftime("%Y-%m-%d"),
1257
            'member_join_policy': 2,
1258
            'member_leave_policy': 1,
1259
            'service1.resource_uplimit': 100,
1260
            'is_selected_service1.resource': "1",
1261
            'astakos.pending_app_uplimit': 100,
1262
            'is_selected_accounts': "1",
1263
            'user': self.user.pk
1264
        }
1265
        form = forms.ProjectApplicationForm(data=application_data)
1266
        # form is invalid
1267
        self.assertEqual(form.is_valid(), False)
1268

  
1269
        del application_data['astakos.pending_app_uplimit']
1270
        del application_data['is_selected_accounts']
1271
        form = forms.ProjectApplicationForm(data=application_data)
1272
        self.assertEqual(form.is_valid(), True)
1273

  
1274
    @im_settings(PROJECT_ADMINS=['uuid1'])
1244 1275
    def test_applications(self):
1245 1276
        # let user have 2 pending applications
1246 1277
        self.user.add_resource_policy('astakos.pending_app', 2)
......
1261 1292
            'member_join_policy': 2,
1262 1293
            'member_leave_policy': 1,
1263 1294
            'service1.resource_uplimit': 100,
1264
            'is_selected_service1.resource': 1,
1295
            'is_selected_service1.resource': "1",
1265 1296
            'user': self.user.pk
1266 1297
        }
1267 1298
        r = self.user_client.post(post_url, data=application_data, follow=True)

Also available in: Unified diff