Exemplo n.º 1
0
    def test_update_service_account(self, *args):
        new_service_account_vo = ServiceAccountFactory(
            domain_id=self.domain_id)
        params = {
            'service_account_id': new_service_account_vo.service_account_id,
            'name': 'Update Account Name',
            'data': {
                'account_id': 'update-1234'
            },
            'tags': {
                'tag_key': 'tag_value'
            },
            'domain_id': self.domain_id
        }

        self.transaction.method = 'update'
        service_account_svc = ServiceAccountService(
            transaction=self.transaction)
        service_account_vo = service_account_svc.update(params.copy())

        print_data(service_account_vo.to_dict(), 'test_update_service_account')
        ServiceAccountInfo(service_account_vo)

        self.assertIsInstance(service_account_vo, ServiceAccount)
        self.assertEqual(new_service_account_vo.service_account_id,
                         service_account_vo.service_account_id)
        self.assertEqual(params['name'], service_account_vo.name)
        self.assertEqual(params['data'], service_account_vo.data)
        self.assertEqual(params['tags'],
                         utils.tags_to_dict(service_account_vo.tags))
Exemplo n.º 2
0
    def test_release_service_account_project(self, *args):
        new_service_account_vo = ServiceAccountFactory(
            domain_id=self.domain_id, project=self.project_vo)
        params = {
            'service_account_id': new_service_account_vo.service_account_id,
            'release_project': True,
            'domain_id': self.domain_id
        }

        self.transaction.method = 'update'
        service_account_svc = ServiceAccountService(
            transaction=self.transaction)
        service_account_vo = service_account_svc.update(params.copy())

        print_data(service_account_vo.to_dict(),
                   'test_release_service_account_project')
        ServiceAccountInfo(service_account_vo)

        self.assertIsInstance(service_account_vo, ServiceAccount)
        self.assertIsNone(service_account_vo.project)