Ejemplo n.º 1
0
    def test_extract_header_ignore_garbage_around_header(self):
        expected = "foo: bar\nfoo2: bar2"
        mockfile = StringIO("garbage\n---\nfoo: bar\nfoo2: bar2\n---\ngarbage\n")

        result = testfile.extract_header(mockfile)
        self.assertEquals(expected, result)
Ejemplo n.º 2
0
    def test_extract_header_two_lines(self):
        expected = "foo: bar\nfoo2: bar2"
        mockfile = StringIO("---\nfoo: bar\nfoo2: bar2\n---\n")

        result = testfile.extract_header(mockfile)
        self.assertEquals(expected, result)
Ejemplo n.º 3
0
    def test_extract_header_with_only_one_delimiter(self):
        expected = ""
        mockfile = StringIO("---\n")

        result = testfile.extract_header(mockfile)
        self.assertEquals(expected, result)
Ejemplo n.º 4
0
    def test_extract_header_empty_header(self):
        expected = ""
        mockfile = StringIO("---\n---\n")

        result = testfile.extract_header(mockfile)
        self.assertEquals(expected, result)
Ejemplo n.º 5
0
    def test_extract_header_no_header_in_file(self):
        expected = ""
        mockfile = StringIO("foobar\nfoobar\nfoobar")

        result = testfile.extract_header(mockfile)
        self.assertEquals(expected, result)