Ejemplo n.º 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')
Ejemplo n.º 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('')
Ejemplo n.º 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('')
Ejemplo n.º 4
0
 def test_getStatus_wrong_id (self):
     processor =  SingularService ()
     retcode = processor.getStatus (WebServiceTests.username, WebServiceTests.password, 'whatever')
     self.assertEqual (retcode[0], (True, 'badid'))
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 8
0
 def test_getChannels_ok_with_channels (self): 
     processor =  SingularService ()
     retcode = processor.getChannels ('clienteBase', WebServiceTests.password2)
     self.assertEqual (retcode, [u'canal1'])
Ejemplo n.º 9
0
 def test_getChannels_ok_without_channels (self):
     processor =  SingularService ()
     retcode = processor.getChannels ('customer1', WebServiceTests.password2)
     self.assertEqual (retcode, [])
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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'))
Ejemplo n.º 14
0
 def test_getStatus_with_id (self):
     processor =  SingularService ()
     retcode = processor.getStatus (WebServiceTests.username, WebServiceTests.password, 'testMessage1')
     self.assertEqual (retcode[0], (False, u''))