Пример #1
0
 def test_check_id_error (self):
     """
         If the Id is valid and pepito is the owner of the message and there is an error.
     """
     customer = Customer.get_customer ('pepito', 'password')
     (status, status_msg) = SMSHistory.check_id (customer, 'testMessage2')[0]
     self.assertEqual ((status, status_msg), (True, 'A critical error'))
Пример #2
0
 def test_check_id_not_error (self):
     """
         If the Id is valid, pepito is the owner of the message and there isn't an error
     """
     customer = Customer.get_customer ('pepito', 'password')
     (status, status_msg) = SMSHistory.check_id (customer, 'testMessage1')[0]
     self.assertEqual ((status, status_msg), (False, ''))
Пример #3
0
 def test_check_id_invalid_id (self):
     """
         If the Id is invalid
     """
     customer = Customer.get_customer ('pepito', 'password')
     (status, status_msg) = SMSHistory.check_id (customer, '{--Invalid_ID--}')[0]
     self.assertEqual ((status, status_msg), (True, 'badid'))
Пример #4
0
 def test_check_id_not_owner (self):
     """
         If the Id is valid but pepito is not the owner of the message.
     """
     #customer = Customer.objects.get (user__username='******')
     customer = Customer.objects.get(username='******')
     (status, status_msg) = SMSHistory.check_id (customer, 'testMessage1')[0]
     self.assertEqual ((status, status_msg), (True, 'badid'))
Пример #5
0
def get_status(username, password, id):
    """
        Return msg status given by his id
    """
    customer = Customer.get_customer (username, password)
    if customer < 0:
        return [str(FAIL_STATUS), "Customer error, please check your customer id and password"]
    l = SMSHistory.check_id (customer, id)
    if l:
        return [str(l[0]), str(l[1])]
    return [str(NONE_STATUS), "Msg %s not found on system, try it later" % id]