def fill_data(self): ''' Fills in dummy content that we will use for testing 2 members, Peter and Hans. 2 workgroups, Systems and Besteling. Peter is the only member in Systems. Both are members in Bestel, with Hans leading that one. Bestel has a shift ('do stuff') for Peter. ''' m1 = Member(fname=u'Peter', prefix=u'de', lname='Pan') m1.mem_email = '*****@*****.**' m1.mem_enc_pwd = md5_crypt.hash('notsecret') self.DBSession.add(m1) m2 = Member(fname=u'Hans', prefix=u'de', lname='Wit') m1.mem_email = '*****@*****.**' self.DBSession.add(m2) wg1 = Workgroup(name=u'Systems', desc=u'IT stuff') self.DBSession.add(wg1) wg2 = Workgroup(name=u'Besteling', desc=u'Besteling at wholesale') self.DBSession.add(wg2) self.DBSession.flush() # flush now to get member and workgroup IDs wg1.members.append(m1) wg1.leaders.append(m1) wg2.members.append(m1) wg2.members.append(m2) wg2.leaders.append(m2) self.DBSession.flush() s = Shift(wg2.id, 'do stuff', 2012, 6, member=m1) self.DBSession.add(s) self.DBSession.flush() # reserved transaction types for rt in reserved_ttype_names: self.DBSession.add(TransactionType(name=rt)) self.DBSession.flush()
def addAdmin(): ''' after old names are added, he has ID 3 ''' admin = Member(fname=u'Adalbert', lname='Adminovic') admin.mem_email = '*****@*****.**' admin.mem_mobile = "06" + unicode(random.randint(10000000, 100000000)) admin.household_size = 1 salt = md5crypt('notsecret', '') admin.mem_enc_pwd = md5crypt('notsecret', salt) admin.mem_admin = True admin.mem_active = True DBSession.add(admin) DBSession.flush() wgs = DBSession.query(Workgroup).filter( Workgroup.name == u'Systems').first() wgs.members.append(admin) wgm = DBSession.query(Workgroup).filter( Workgroup.name == u'Membership').first() wgm.members.append(admin)
def addOldNames(): m1 = Member(fname=u'Peter', prefix=u'de', lname='Pan') m1.mem_email = '*****@*****.**' m1.mem_enc_pwd = md5crypt('notsecret', 'notsecret') DBSession.add(m1) m2 = Member(fname=u'Hans', prefix=u'de', lname='Wit') m1.mem_email = '*****@*****.**' DBSession.add(m2) wg1 = Workgroup(name=u'Systems', desc=u'IT stuff') DBSession.add(wg1) wg2 = Workgroup(name=u'Besteling', desc=u'Besteling at wholesale') DBSession.add(wg2) DBSession.flush() # flush now to get member and workgroup IDs wg1.members.append(m1) wg1.leaders.append(m1) wg2.members.append(m1) wg2.members.append(m2) wg2.leaders.append(m2) DBSession.flush() s = Shift(wg2.id, 'do stuff', 2012, 6, member=m1) DBSession.add(s) DBSession.flush()