Пример #1
0
class GatewayModel(TestCase):

    """Test Gateway model"""

    def setUp(self):
        self.gateway = Gateway(
            name='test gateway',
            status=2,
            removeprefix='94'
        )
        self.gateway.set_name("MyGateway")
        self.gateway.save()
        self.assertEqual(self.gateway.__unicode__(), u'MyGateway')

        response = prepare_phonenumber('9897525414', '91', '+', self.gateway.status)
        self.assertEqual(response, False)

        response = prepare_phonenumber('', '91', '+', self.gateway.status)
        self.assertEqual(response, False)

        response = prepare_phonenumber('+9897525414', '91', '+', self.gateway.status)
        self.assertEqual(response, False)

        self.gateway.status = 1
        self.gateway.save()
        response = prepare_phonenumber('9897525414', '91', '+', self.gateway.status)
        self.assertEqual(response, '919897525414')

    def test_name(self):
        self.assertEqual(self.gateway.name, "MyGateway")

    def teardown(self):
        self.gateway.delete()
Пример #2
0
    def setUp(self):
        self.gateway = Gateway(
            name='test gateway',
            status=2,
            removeprefix='94'
        )
        self.gateway.set_name("MyGateway")
        self.gateway.save()
        self.assertEqual(self.gateway.__unicode__(), u'MyGateway')

        response = prepare_phonenumber('9897525414', '91', '+', self.gateway.status)
        self.assertEqual(response, False)

        response = prepare_phonenumber('', '91', '+', self.gateway.status)
        self.assertEqual(response, False)

        response = prepare_phonenumber('+9897525414', '91', '+', self.gateway.status)
        self.assertEqual(response, False)

        self.gateway.status = 1
        self.gateway.save()
        response = prepare_phonenumber('9897525414', '91', '+', self.gateway.status)
        self.assertEqual(response, '919897525414')