def setUp(self):
        super(TestWorkflow, self).setUp()

        # create the profiles that will interact with the idea
        user_repository = UserRepository()
        self.facilitator = user_repository.facilitator
        self.developer = user_repository.developer
        self.admin = user_repository.admin
        self.author = user_repository.create(uid=u'author',
                                             email=u'*****@*****.**',
                                             firstname=u'John',
                                             lastname=u'Doe',
                                             position=u'author',
                                             fi=self.facilitator)

        # create an idea domain
        domain = DomainData(
            label=u'domain',
            rank=100,
            en_label=u'en',
            fr_label=u'fr',
        )

        # create an idea
        self.idea = IdeaRepository().create(title=u'Title',
                                            description=u'description',
                                            impact=u'impact',
                                            submitted_by=self.author,
                                            domain=domain)
Ejemplo n.º 2
0
def import_domains_csv(csv_file):
    reader = UnicodeDictReader(csv_file, delimiter=';')

    for line in reader:
        d = DomainData()
        d.label = line['label'].strip()
        d.rank = int(line['rank'].strip())
        d.en_label = line['en_label'].strip()
        d.fr_label = line['fr_label'].strip()

    session.flush()