def setUpClass(cls): cls.limit = random.randint(1, 10) cls.key = models.Config(key='max_groups_per_subscriber', value=str(cls.limit)) cls.key.save() # create dummy admin cls.admin = User(username='******', email='*****@*****.**') cls.admin.save() # create dummy subscribers cls.imsi = 'IMSI001010000009999' cls.callerid = '639991111111' cls.subscriber = models.Contact(imsi=cls.imsi, callerid=cls.callerid) cls.subscriber.save() cls.imsi1 = 'IMSI001010000009990' cls.callerid1 = '639991111112' cls.subscriber1 = models.Contact(imsi=cls.imsi1, callerid=cls.callerid1) cls.subscriber1.save() cls.imsi2 = 'IMSI001010000009991' cls.callerid2 = '639991111113' cls.subscriber2 = models.Contact(imsi=cls.imsi2, callerid=cls.callerid2) cls.subscriber2.save()
def setUpClass(cls): super(GroupDiscountPromoTest, cls).setUpClass() cls.imsi = 'IMSI001010000009999' cls.callerid = '639991111111' cls.subscriber = models.Contact(imsi=cls.imsi, callerid=cls.callerid) cls.subscriber.save() cls.quota = [float_to_mc(random.randint(1, 10)), float_to_mc(random.randint(1, 10)), float_to_mc(random.randint(1, 10)), float_to_mc(random.randint(1, 10))] cls.promo = models.Promo(author=cls.admin, name='Group Discount Promo', price=float_to_mc(10), promo_type='G', keyword='GPROMO', number='555', local_sms=cls.quota[0], local_call=cls.quota[1], outside_sms=cls.quota[2], outside_call=cls.quota[3]) cls.promo.save() cls.subscription = None # Create a dummy group and group members # From FS, we are passing in group name in uppercase cls.imsi1 = 'IMSI001010000009990' cls.callerid1 = '639991111112' cls.subscriber1 = models.Contact(imsi=cls.imsi1, callerid=cls.callerid1) cls.subscriber1.save() cls.imsi2 = 'IMSI001010000009991' cls.callerid2 = '639991111113' cls.subscriber2 = models.Contact(imsi=cls.imsi2, callerid=cls.callerid2) cls.subscriber2.save() cls.groupname = 'dummy_group'.upper() cls.dummygroup = models.Group(name=cls.groupname, owner=cls.subscriber) cls.dummygroup.save() cls.gm1 = models.GroupMembers(group=cls.dummygroup, user=cls.subscriber1, date_joined=timezone.now()) cls.gm1.save()
def setUpClass(cls): cls.username = '******' cls.password = '******' cls.user = User(username=cls.username, email='*****@*****.**') cls.user.set_password(cls.password) cls.user.save() cls.test_promo = models.Promo(author=cls.user, name='Bulk Promo', price=float_to_mc(10), promo_type='B', keyword='BULKPROMO', validity='2', local_sms=10, local_call=10, outside_sms=10, outside_call=10) cls.test_promo.save() # Create a subscriber and make him subscribe to our dummy promo cls.manuel = models.Contact(imsi='IMSI00101000000000', callerid='63999000000') cls.manuel.save() cls.subscription = models.PromoSubscription(promo=cls.test_promo, contact=cls.manuel, local_sms=10, local_call=10, outside_sms=10, outside_call=10) cls.subscription.save() # Create a test client. cls.client = Client()
def setUpClass(cls): """ Let's setup our testing workspace""" cls.username = '******' cls.password = '******' cls.admin = User(username=cls.username, email='*****@*****.**') cls.admin.set_password(cls.password) cls.admin.save() # Fetch auto-created Contact for admin cls.admincontact = models.Contact.objects.get( imsi=settings.PCARI['ADMIN_IMSI']) # Create ordinary contact cls.manuel = models.Contact(imsi='IMSI00101000000000', callerid='63999000000') cls.manuel.save() # Create dummy message cls.msg = models.Message(author=cls.admincontact, message='dummy hello message') cls.msg.save() cls.msg_recv = models.MessageRecipients(message=cls.msg, user=cls.manuel) cls.msg_recv.save() # Create a test client. cls.client = Client()
def setUpClass(cls): # create dummy admin cls.admin = User(username='******', email='*****@*****.**') cls.admin.save() # Fetch auto-created Contact for admin cls.admincontact = models.Contact.objects.get( imsi=settings.PCARI['ADMIN_IMSI']) # create test subscriber cls.imsi = 'IMSI001010000009999' cls.callerid = '639991111111' cls.subscriber = models.Contact(imsi=cls.imsi, callerid=cls.callerid) cls.subscriber.save() cls.keyword = 'KEY' cls.report = models.Report( name='Sample Report', keyword=cls.keyword, number='111', author=cls.admin, chatplan='sample.xml', status='P', ) models.Report.create_or_update_chatplan = Mock(return_value=None) cls.report.save() cls.manager = models.ReportManagers(report=cls.report, manager=cls.admincontact) cls.manager.save()
def setUpClass(cls): cls.username = '******' cls.password = '******' cls.user = User(username=cls.username, email='*****@*****.**') cls.user.set_password(cls.password) cls.user.save() # Create a dummy contact cls.manuel = models.Contact(callerid='639990000000', imsi='IMSI00101000000000') cls.manuel.save() cls.manuel_profile = models.ContactProfile(uuid=1111, firstname="Manuel", lastname="Roxas", nickname="Manu", age=30, gender='Male', municipality='San Luis', barangay='Dikapinisan', sitio='Dikapinisan Proper') cls.manuel_profile.save() # NOTE: initial number of contacts is two (2) because the creation of # the superuser auto-creates a Contact entry # Create a test client. cls.client = Client() # mock SipBuddies query with none set Subscribers.objects.all = Mock(return_value=Subscribers.objects.none())
def setUpClass(cls): """ Let's setup our testing workspace""" super(CircleCrudTests, cls).setUpClass() # Create ordinary contacts cls.manuel = models.Contact(imsi='IMSI00101000000000', callerid='63999000000') cls.emilio = models.Contact(imsi='IMSI00101000000001', callerid='63999000001') cls.ramon = models.Contact(imsi='IMSI00101000000002', callerid='63999000002') cls.manuel.save() cls.emilio.save() cls.ramon.save() # Create some circle entries cls.bilog = models.Circle(name='Circulo', description='Dummy text', owner=cls.admin) cls.bilog.save() cls.bilogusers1 = models.CircleUsers(circle=cls.bilog, user=cls.manuel, date_joined=timezone.now()) cls.bilogusers2 = models.CircleUsers(circle=cls.bilog, user=cls.emilio, date_joined=timezone.now()) cls.bilogusers1.save() cls.bilogusers2.save() # Create second circle cls.bilog2 = models.Circle(name='Bilog na hugis itlog', description='Dummy text', owner=cls.admin) cls.bilog2.save() cls.bilog2users1 = models.CircleUsers(circle=cls.bilog, user=cls.ramon, date_joined=timezone.now()) cls.bilog2users1.save() cls.msg = models.Message(author=cls.admincontact) cls.msg.save()
def setUpClass(cls): cls.key = models.Config(key='max_groups_per_subscriber', value='NA') cls.key.save() # create dummy admin cls.admin = User(username='******', email='*****@*****.**') cls.admin.save() # create dummy subscribers cls.imsi = 'IMSI001010000009999' cls.callerid = '639991111111' cls.subscriber = models.Contact(imsi=cls.imsi, callerid=cls.callerid) cls.subscriber.save() cls.imsi1 = 'IMSI001010000009990' cls.callerid1 = '639991111112' cls.subscriber1 = models.Contact(imsi=cls.imsi1, callerid=cls.callerid1) cls.subscriber1.save() cls.imsi2 = 'IMSI001010000009991' cls.callerid2 = '639991111113' cls.subscriber2 = models.Contact(imsi=cls.imsi2, callerid=cls.callerid2) cls.subscriber2.save() # Create a dummy group and group members # From FS, we are passing in group name in uppercase cls.groupname = 'dummy_group'.upper() cls.dummygroup = models.Group(name=cls.groupname, owner=cls.subscriber) cls.dummygroup.save() cls.gm1 = models.GroupMembers(group=cls.dummygroup, user=cls.subscriber1, date_joined=timezone.now()) cls.gm1.save()
def setUpClass(cls): cls.imsi = 'IMSI001010000009999' cls.callerid = '639991111111' cls.subscriber = models.Contact(imsi=cls.imsi, callerid=cls.callerid) cls.subscriber.save()