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)
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)
def test_extract_header_with_only_one_delimiter(self): expected = "" mockfile = StringIO("---\n") result = testfile.extract_header(mockfile) self.assertEquals(expected, result)
def test_extract_header_empty_header(self): expected = "" mockfile = StringIO("---\n---\n") result = testfile.extract_header(mockfile) self.assertEquals(expected, result)
def test_extract_header_no_header_in_file(self): expected = "" mockfile = StringIO("foobar\nfoobar\nfoobar") result = testfile.extract_header(mockfile) self.assertEquals(expected, result)