Ejemplo n.º 1
0
    def test_locate_with_fake_path(self):
        def function(resource):
            return None

        locator = ioc.locator.FunctionLocator(function)

        with self.assertRaises(ioc.locator.ResourceNotFound):
            locator.locate('missing file')
Ejemplo n.º 2
0
    def test_locate_with_fake_path(self):
        def function(resource):
            return None

        locator = ioc.locator.FunctionLocator(function)

        with self.assertRaises(ioc.locator.ResourceNotFound):
            locator.locate('missing file')
Ejemplo n.º 3
0
    def test_locate(self):
        locator = ioc.locator.ChoiceLocator([
            ioc.locator.FileSystemLocator("/tmp"),
            ioc.locator.FileSystemLocator(current_dir + "/../fixtures"),
        ])

        self.assertEquals(current_dir + "/../fixtures/services.yml", locator.locate('services.yml'))
Ejemplo n.º 4
0
    def test_locate(self):
        def function(resource):
            return "/mypath/%s" % resource

        locator = ioc.locator.FunctionLocator(function)

        self.assertEquals("/mypath/services.yml", locator.locate('services.yml'))
Ejemplo n.º 5
0
    def test_locate(self):
        locator = ioc.locator.ChoiceLocator([
            ioc.locator.FileSystemLocator("/tmp"),
            ioc.locator.FileSystemLocator(current_dir + "/../fixtures"),
        ])

        self.assertEquals(current_dir + "/../fixtures/services.yml",
                          locator.locate('services.yml'))
Ejemplo n.º 6
0
    def test_locate(self):
        def function(resource):
            return "/mypath/%s" % resource

        locator = ioc.locator.FunctionLocator(function)

        self.assertEquals("/mypath/services.yml",
                          locator.locate('services.yml'))
Ejemplo n.º 7
0
    def test_locate(self):
        locator = ioc.locator.PrefixLocator(
            {
                "app":
                ioc.locator.FileSystemLocator(current_dir + "/../fixtures")
            }, ":")

        self.assertEquals(current_dir + "/../fixtures/services.yml",
                          locator.locate('app:services.yml'))
Ejemplo n.º 8
0
 def test_locate(self):
     locator = ioc.locator.PackageLocator('tests', 'fixtures')
     self.assertEquals(
         os.path.realpath(current_dir + "/../fixtures/services.yml"),
         locator.locate('services.yml'))
Ejemplo n.º 9
0
    def test_locate_with_fake_path(self):
        locator = ioc.locator.PrefixLocator({})

        with self.assertRaises(ioc.locator.ResourceNotFound):
            locator.locate('missing file')
Ejemplo n.º 10
0
    def test_locate_with_fake_path(self):
        locator = ioc.locator.FileSystemLocator('fake')

        with self.assertRaises(ioc.locator.ResourceNotFound):
            locator.locate('missing file')
Ejemplo n.º 11
0
 def test_locate(self):
     locator = ioc.locator.PackageLocator('tests', 'fixtures')
     self.assertEquals(os.path.realpath(current_dir + "/../fixtures/services.yml"), locator.locate('services.yml'))
Ejemplo n.º 12
0
    def test_locate(self):
        locator = ioc.locator.PrefixLocator({
            "app" : ioc.locator.FileSystemLocator(current_dir + "/../fixtures")
        }, ":")

        self.assertEquals(current_dir + "/../fixtures/services.yml", locator.locate('app:services.yml'))
Ejemplo n.º 13
0
    def test_locate_with_fake_path(self):
        locator = ioc.locator.PrefixLocator({})

        with self.assertRaises(ioc.locator.ResourceNotFound):
            locator.locate('missing file')
Ejemplo n.º 14
0
    def test_locate_with_fake_path(self):
        locator = ioc.locator.FileSystemLocator('fake')

        with self.assertRaises(ioc.locator.ResourceNotFound):
            locator.locate('missing file')