示例#1
0
 def test_create_msgchannel_ok(self):
     username = self.username
     password = "******"
     resp = self.client.post( reverse('root'), {'username':username,'password':password})
     self.failUnlessEqual( resp.status_code, 200 )						
     id = Channel.create_one(text=self.text, account=self.OKaccount, activationDate=self.now,channel_name="canal1")
     if (id == Channel.CHANNEL_DOES_NOT_EXIST):
         self.fail("Dont send message to Channel")
     else:
         self.assertEqual
示例#2
0
def send_sms_channel(username, password, account, channel, text, activationDate = None):
    """
        Send a msg to a channel, with a account given        
    """
    try:
        account = Customer.check_customer_and_credit (username, password, account)
    except OutOfCredit:
        return ACCOUNT_NO_CREDIT
    if account < 0:
        return account
    if activationDate is None:
        activationDate = datetime.datetime.now ()
    chmsg_id = Channel.create_one (text, channel, account, activationDate)
    return Message.objects.get(channelmessage__id = chmsg_id).id