예제 #1
0
 def test_getAccounts_ok_with_accounts (self):
     processor =  SingularService ()
     retcode = processor.getAccounts (WebServiceTests.username, WebServiceTests.password)
     self.assertEqual (len(retcode), 3)
     self.assertEqual (retcode[0], 'AccessNoPurchase')
     self.assertEqual (retcode[1], 'AccessWithPurchase')
     self.assertEqual (retcode[2], 'AccessSeveralPurchases')
예제 #2
0
 def test_getCredit_no_credit(self):
     processor =  SingularService ()
     try:
         retcode = processor.getCredit (WebServiceTests.username, WebServiceTests.password, 'AccessNoPurchase')
     except OutOfCredit:
         self.assertTrue
     else:
         self.fail('')
예제 #3
0
 def test_sendSMS_no_credit (self):
     processor =  SingularService ()
     try:
         retcode = processor.sendSMS (WebServiceTests.username, WebServiceTests.password,
         'AccessNoPurchase', 'foo', 'bar', datetime.datetime.now())
     except OutOfCredit:
         self.assertTrue
     else:
         self.fail('')
예제 #4
0
 def test_getStatus_wrong_id (self):
     processor =  SingularService ()
     retcode = processor.getStatus (WebServiceTests.username, WebServiceTests.password, 'whatever')
     self.assertEqual (retcode[0], (True, 'badid'))
예제 #5
0
 def test_getStatus_wrong_password (self):
     processor =  SingularService ()
     retcode = processor.getStatus (WebServiceTests.wrong_username, WebServiceTests.wrong_password, 'whatever')
     self.assertEqual (retcode, Customer.WRONG_USERNAME_OR_PASSWORD)
예제 #6
0
 def test_getCredit_credit(self):
     processor =  SingularService ()
     retcode = processor.getCredit (WebServiceTests.username, WebServiceTests.password, 'AccessSeveralPurchases')
     # TODO: Don't hardcode this:
     self.assertEqual (retcode, 28)
예제 #7
0
 def test_getCredit_wrong_password (self):
     processor =  SingularService ()
     retcode = processor.getCredit (WebServiceTests.wrong_username, WebServiceTests.wrong_password, 'AccessNoPurchase')
     self.assertEqual (retcode, Customer.WRONG_USERNAME_OR_PASSWORD)
예제 #8
0
 def test_getChannels_ok_with_channels (self): 
     processor =  SingularService ()
     retcode = processor.getChannels ('clienteBase', WebServiceTests.password2)
     self.assertEqual (retcode, [u'canal1'])
예제 #9
0
 def test_getChannels_ok_without_channels (self):
     processor =  SingularService ()
     retcode = processor.getChannels ('customer1', WebServiceTests.password2)
     self.assertEqual (retcode, [])
예제 #10
0
 def test_sendSMS (self):
     processor =  SingularService ()
     retcode = processor.sendSMS (WebServiceTests.username, WebServiceTests.password,
         'AccessWithPurchase', 'foo', 'bar', datetime.datetime.now())
     self.assertEqual (retcode, 3)
예제 #11
0
 def test_sendSMS_wrong_account (self):
     processor =  SingularService ()
     retcode = processor.sendSMS (WebServiceTests.username, WebServiceTests.password,
         'wrongAccount', 'foo', 'bar', datetime.datetime.now())
     self.assertEqual (retcode, Customer.WRONG_ACCOUNT)
예제 #12
0
 def test_sendSMS_wrong_password (self):
     processor =  SingularService ()
     retcode = processor.sendSMS (WebServiceTests.wrong_username, WebServiceTests.wrong_password,
         'whatever', 'foo', 'bar', datetime.datetime.now())
     self.assertEqual (retcode, Customer.WRONG_USERNAME_OR_PASSWORD)
예제 #13
0
 def test_getStatus_with_id_not_owner (self):
     processor =  SingularService ()
     retcode = processor.getStatus ('customer1', WebServiceTests.password2, 'testMessage1')
     self.assertEqual (retcode[0], (True, 'badid'))
예제 #14
0
 def test_getStatus_with_id (self):
     processor =  SingularService ()
     retcode = processor.getStatus (WebServiceTests.username, WebServiceTests.password, 'testMessage1')
     self.assertEqual (retcode[0], (False, u''))