Пример #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_get_channel_from_customer(self):
     """
         Checks if a customer have a channel or not
     """
     customer = Customer.get_customer(self.customer_name, self.customer_pass)
     if customer is Customer.WRONG_USERNAME_OR_PASSWORD:
         self.fail('Couldnt get the customer')        
     self.assertEqual(False, Customer.can_send_to_channel(customer, channel='this_channel_doesnt_exists'))
Пример #5
0
 def test_get_customer_invalid_password (self):
     """
         No valid password --> Customer.WRONG_USERNAME_OR_PASSWORD
     """
     customer = Customer.get_customer ('pepito', 'passwordNoValid')
     self.assertEqual (customer, Customer.WRONG_USERNAME_OR_PASSWORD)  	
Пример #6
0
 def test_get_customer_ok (self):
     """
         If you provide a correct username and password you'll get a Customer.
     """
     customer = Customer.get_customer (self.customer_name, self.customer_pass)
     self.assertEqual (customer, Customer.objects.get(username=self.customer_name) )