예제 #1
0
 def test_get_yaml_from_uri_from_missing_file(self):
     filename = "/asdfasdfasdfasfasdf_does_not_exist"
     try:
         get_yaml_from_uri(filename)
         self.fail("Expected exception")
     except MultiProjectException:
         pass
     try:
         get_path_specs_from_uri(filename)
         self.fail("Expected exception")
     except MultiProjectException:
         pass
예제 #2
0
 def test_get_yaml_from_uri_from_missing_file(self):
     filename = "/asdfasdfasdfasfasdf_does_not_exist"
     try:
         get_yaml_from_uri(filename)
         self.fail("Expected exception")
     except MultiProjectException:
         pass
     try:
         get_path_specs_from_uri(filename)
         self.fail("Expected exception")
     except MultiProjectException:
         pass
예제 #3
0
    def test_get_yaml_from_uri_from_invalid_url(self):
        url = "http://invalidurl"
        try:
            get_yaml_from_uri(url)
            self.fail("Expected exception")
        except MultiProjectException:
            pass

        # valid but non-yaml
        url = "http://www.google.com"
        try:
            get_yaml_from_uri(url)
            self.fail("Expected exception")
        except MultiProjectException:
            pass
예제 #4
0
    def test_get_yaml_from_uri_from_invalid_url(self):
        url = "http://invalidurl"
        try:
            get_yaml_from_uri(url)
            self.fail("Expected exception")
        except MultiProjectException:
            pass

        # valid but non-yaml
        url = "http://www.google.com"
        try:
            get_yaml_from_uri(url)
            self.fail("Expected exception")
        except MultiProjectException:
            pass
예제 #5
0
    def test_get_yaml_from_uri_from_file(self):
        filename = os.path.join(_test_root, "example.yaml")
        yamlstr = get_yaml_from_uri(filename)

        self.assertTrue("text" in yamlstr)
        self.assertTrue(yamlstr["text"] == "foobar")

        self.assertTrue("number" in yamlstr)
        self.assertTrue(yamlstr["number"] == 2)
        # invalid
        try:
            yaml = get_yaml_from_uri(
                os.path.join(_test_root, "example-broken.yaml"))
        except MultiProjectException:
            pass
        try:
            get_path_specs_from_uri(filename)
            self.fail("Expected exception")
        except MultiProjectException:
            pass
예제 #6
0
    def test_get_yaml_from_uri_from_file(self):
        filename = os.path.join(_test_root, "example.yaml")
        yamlstr = get_yaml_from_uri(filename)

        self.assertTrue("text" in yamlstr)
        self.assertTrue(yamlstr["text"] == "foobar")

        self.assertTrue("number" in yamlstr)
        self.assertTrue(yamlstr["number"] == 2)
        # invalid
        try:
            yaml = get_yaml_from_uri(
                os.path.join(_test_root, "example-broken.yaml"))
        except MultiProjectException:
            pass
        try:
            get_path_specs_from_uri(filename)
            self.fail("Expected exception")
        except MultiProjectException:
            pass