Ejemplo n.º 1
0
 def setUpClass(cls):
     """ Set up our Verifone client for tests. It requires the following environment variables: AGREEMENTCODE, RSAPRIVATEKEY and EMAIL """
     cls._verifone_client = verifone.Verifone(
         os.environ.get('AGREEMENTCODE'), os.environ.get('RSAPRIVATEKEY'),
         os.environ.get('RSAVERIFONEPUBLICKEY'), "IntegrationTest",
         "6.0.37")
     cls._test_requests = os.environ.get('TESTSENDINGREQUEST')
     cls._verifone_client_2 = verifone.Verifone(
         os.environ.get('AGREEMENTCODE'),
         os.environ.get('RSAPRIVATEKEY'),
         os.environ.get('RSAVERIFONEPUBLICKEY'),
         "IntegrationTest",
         "6.0.37",
         return_error_dict=1)
Ejemplo n.º 2
0
    def test_003_create_object_wrong_currency(self):
        """ Test creating a new object with wrong currency, so default currency should be used """
        default_currency = 'EUR'
        verifone_cl = verifone.Verifone('test_apikey', '1234', 'Test',
                                        'IntegrationTest', '6.0.37', 'euro')
        self.assertEqual(verifone_cl._currency, default_currency)

        verifone_cl = verifone.Verifone('test_apikey', '1234', 'Test',
                                        'IntegrationTest', '6.0.37', 'eu1')
        self.assertEqual(verifone_cl._currency, default_currency)

        verifone_cl = verifone.Verifone('test_apikey', '1234', 'Test',
                                        'IntegrationTest', '6.0.37', '€')
        self.assertEqual(verifone_cl._currency, default_currency)

        verifone_cl = verifone.Verifone('test_apikey', '1234', 'Test',
                                        'IntegrationTest', '6.0.37', 'abc')
        self.assertNotEqual(verifone_cl._currency, default_currency)
Ejemplo n.º 3
0
    def test_022_save_test_mode(self):
        """ Test for save test mode """
        verifone_cl = verifone.Verifone('test_apikey', '1234', 'Test',
                                        'IntegrationTest', '6.0.37', 'eur')
        self.assertEqual(verifone_cl.test_mode, 0)

        verifone_cl.test_mode = 1
        self.assertEqual(verifone_cl.test_mode, 1)

        with self.assertRaises(ValueError):
            verifone_cl.test_mode = 3

        verifone_cl.test_mode = None
        self.assertEqual(verifone_cl.test_mode, 0)
Ejemplo n.º 4
0
    def test_021_get_endpoint(self):
        """ Test for getting endpoints """
        verifone_cl = verifone.Verifone('test_apikey', '1234', 'Test',
                                        'IntegrationTest', '6.0.37', 'eur')
        self.assertEqual(verifone_cl.endpoint,
                         'https://epayment1.point.fi/pw/serverinterface')
        self.assertEqual(verifone_cl.endpoint2,
                         'https://epayment2.point.fi/pw/serverinterface')

        verifone_cl.test_mode = 1
        self.assertEqual(verifone_cl.endpoint,
                         'https://epayment.test.point.fi/pw/serverinterface')
        self.assertEqual(verifone_cl.endpoint2,
                         'https://epayment.test.point.fi/pw/serverinterface')
Ejemplo n.º 5
0
    def test_023_get_endpoint(self):
        """ Test for getting post urls """
        verifone_cl = verifone.Verifone('test_apikey', '1234', 'Test',
                                        'IntegrationTest', '6.0.37', 'eur')
        self.assertIsNotNone(verifone_cl.posturl)

        self.assertEqual(verifone_cl.posturl1,
                         'https://epayment1.point.fi/pw/payment')
        self.assertEqual(verifone_cl.posturl2,
                         'https://epayment2.point.fi/pw/payment')

        verifone_cl.test_mode = 1
        self.assertIsNotNone(verifone_cl.posturl)
        self.assertEqual(verifone_cl.posturl1,
                         'https://epayment.test.point.fi/pw/payment')
        self.assertEqual(verifone_cl.posturl2,
                         'https://epayment.test.point.fi/pw/payment')
Ejemplo n.º 6
0
 def test_004_create_object_currency_lower(self):
     """ Test creating a new object with currency in lower case """
     verifone_cl = verifone.Verifone('test_apikey', '1234', 'Test',
                                     'IntegrationTest', '6.0.37', 'eur')
     self.assertEqual(verifone_cl._currency, 'EUR')