Exemplo n.º 1
0
# -*- coding: utf-8 -*-
from plugin_friendship import Friendship
from gluon.tools import Auth
import unittest

if request.function == 'test':
    db = DAL('sqlite:memory:')
    
### setup core objects #########################################################
auth = Auth(db)
friendship = Friendship(db)
friendship.settings.table_friend_name = 'plugin_friendship_friend'
friendship.settings.extra_fields = {
    'plugin_friendship_friend': 
        [Field('affinity', 'double', default=1), 
         Field('created_on', 'datetime', default=request.now)],
}

### define tables ##############################################################
auth.define_tables()
table_user = auth.settings.table_user

friendship.define_tables(str(table_user))
table_friend = friendship.settings.table_friend

### populate records ###########################################################
num_users = 4
user_ids = {}
for i in range(1, num_users+1):   
    email = '*****@*****.**' % i
    user = db(table_user.email==email).select().first()
Exemplo n.º 2
0
# -*- coding: utf-8 -*-
from plugin_friendship import Friendship
from gluon.tools import Auth
import unittest
import datetime

if request.function == 'test':
    db = DAL('sqlite:memory:')
    
### setup core objects #########################################################
auth = Auth(db)
friendship = Friendship(db)
friendship.settings.table_edge_name = 'plugin_friendship_edge'
friendship.settings.extra_fields = {
    'plugin_friendship_edge': 
        [Field('affinity', 'double', default=1), 
         Field('created_on', 'datetime', default=request.now)],
}

### define tables ##############################################################
auth.define_tables()
table_user = auth.settings.table_user

friendship.define_tables(str(table_user))
table_edge = friendship.settings.table_edge

### populate records ###########################################################
num_users = 5
user_ids = {}
for user_no in range(1, num_users+1):   
    email = '*****@*****.**' % user_no
Exemplo n.º 3
0
# -*- coding: utf-8 -*-
from plugin_friendship import Friendship
from gluon.tools import Auth
import unittest
import datetime

if request.function == 'test':
    db = DAL('sqlite:memory:')

### setup core objects #########################################################
auth = Auth(db)
friendship = Friendship(db)
friendship.settings.table_edge_name = 'plugin_friendship_edge'
friendship.settings.extra_fields = {
    'plugin_friendship_edge': [
        Field('affinity', 'double', default=1),
        Field('created_on', 'datetime', default=request.now)
    ],
}

### define tables ##############################################################
auth.define_tables()
table_user = auth.settings.table_user

friendship.define_tables(str(table_user))
table_edge = friendship.settings.table_edge

### populate records ###########################################################
num_users = 5
user_ids = {}
for user_no in range(1, num_users + 1):