def test_organization_api_create(self, api):
        '''It should create an organization from the API'''
        data = OrganizationFactory.as_dict()
        user = api.login()
        response = api.post(url_for('api.organizations'), data)
        assert201(response)
        assert Organization.objects.count() is 1

        org = Organization.objects.first()
        member = org.member(user)
        assert member is not None, 'Current user should be a member'
        assert member.role == 'admin', 'Current user should be an administrator'
Esempio n. 2
0
    def test_organization_api_create(self):
        '''It should create an organization from the API'''
        data = OrganizationFactory.as_dict()
        self.login()
        response = self.post(url_for('api.organizations'), data)
        self.assert201(response)
        self.assertEqual(Organization.objects.count(), 1)

        org = Organization.objects.first()
        member = org.member(self.user)
        self.assertIsNotNone(member, 'Current user should be a member')
        self.assertEqual(member.role, 'admin',
                         'Current user should be an administrator')