Beispiel #1
0
    def test_get_cxn(self):
        svc = RpcService()

        svc.source_type = RpcService.PRODUCTION
        cxn = svc.get_cxn()
        self.assertTrue(isinstance(cxn, RpcConnection))

        svc.source_type = RpcService.TEST
        cxn = svc.get_cxn()
        self.assertTrue(isinstance(cxn, RpcConnection))

        svc.source_type = RpcService.VIRTUAL
        cxn = svc.get_cxn()
        self.assertTrue(isinstance(cxn, FakeRpcConnection))
Beispiel #2
0
 def setUp(self):
     my_path = os.path.dirname(os.path.abspath(__file__))
     cfg_path = os.path.abspath(os.path.join(my_path, '../../evista_rpc/rpc.cfg'))
     config = ConfigParser()
     config.read(cfg_path)
     vista = RpcService()
     vista.site_id = config.get('Virtual Vista', 'site_id')
     vista.hostname = config.get('Virtual Vista', 'hostname')
     vista.source_type = config.get('Virtual Vista', 'source_type')
     self.cxn = vista.get_cxn()
Beispiel #3
0
    def test_unique_fields(self):
        from django.db.utils import IntegrityError
        svc = RpcService()
        svc.site_id = '666'
        svc.site_name = 'sourcename1'
        svc.hostname = "somesite1.va.gov"
        svc.source_type = RpcService.PRODUCTION
        svc.svc_set_id = 1
        svc.save()

        svc = RpcService()
        svc.site_id = '666'
        svc.site_name = 'sourcename2'
        svc.hostname = "somesite2.va.gov"
        svc.source_type = RpcService.PRODUCTION
        svc.svc_set_id = 1
        try:
            svc.save()
        except IntegrityError as e:
            self.assertEqual('column site_id is not unique', str(e))

        svc = RpcService()
        svc.site_id = '667'
        svc.site_name = 'sourcename1'
        svc.hostname = "somesite3.va.gov"
        svc.source_type = RpcService.PRODUCTION
        svc.svc_set_id = 1
        try:
            svc.save()
        except IntegrityError as e:
            self.assertEqual('column site_name is not unique', str(e))

        svc = RpcService()
        svc.site_id = '668'
        svc.site_name = 'sourcename2'
        svc.hostname = "somesite1.va.gov"
        svc.source_type = RpcService.PRODUCTION
        svc.svc_set_id = 1
        try:
            svc.save()
        except IntegrityError as e:
            self.assertEqual('column hostname is not unique', str(e))
Beispiel #4
0
 def setUp(self):
     my_path = os.path.dirname(os.path.abspath(__file__))
     cfg_path = os.path.abspath(os.path.join(my_path, '../rpc.cfg'))
     self.config = ConfigParser()
     self.config.read(cfg_path)
     vista = RpcService()
     vista.site_id = self.config.get('My Test Vista', 'site_id')
     vista.hostname = self.config.get('My Test Vista', 'hostname')
     vista.port = int(self.config.get('My Test Vista', 'port'))
     vista.source_type = self.config.get('My Test Vista', 'source_type')
     self.cxn = vista.get_cxn()