示例#1
0
 def test_instance(self):
     self.assertNotEquals(lnk, Link(config1_path))
     #check to make sure this is a singleton
     self.assertEquals(lnk,
                       Link.instance())
示例#2
0
import unittest
import os
from link import Link, Wrapper
from link.utils import load_json_file
from link.tests import *

DIR = os.path.dirname(__file__)
TEST_CONFIG = 'test_link.test_config' 
TEST_CONFIG2 = 'test_link2.test_config'
BAD_CONFIG = 'bad_config.test_config'
NO_CONFIG = 'no_config.test_config'

#load in all the configs that we want
lnk = Link.instance()
config1 = load_tst_config(TEST_CONFIG)
config1_path = tst_config_path(TEST_CONFIG)
config2 = load_tst_config(TEST_CONFIG2)
config2_path = tst_config_path(TEST_CONFIG2)
bad_config_path = tst_config_path(BAD_CONFIG)
#this does not exist
no_config_path = tst_config_path(NO_CONFIG)

FAKE_WRAPPER_PATH1 = tst_file_path('fake_wrappers')
FAKE_WRAPPER_PATH2 = tst_file_path('fake_wrappers.fake_wrap2')
FAKE_WRAPPER_PACKAGE1 = 'fake_wrappers'
FAKE_WRAPPER_PACKAGE2 = 'fake_wrappers.fake_wrap2'

class TestLink(unittest.TestCase):

    def setUp(self):
        #reset the config every time to config1