@@ -85,6 +85,11 @@ def test_get_active_manifest(self):
8585 expected_label = "contentauth:urn:uuid:c85a2b90-f1a0-4aa4-b17f-f938b475804e"
8686 self .assertEqual (active_manifest ["label" ], expected_label )
8787
88+ def test_get_active_manifest_no_manifest (self ):
89+ with open (INGREDIENT_TEST_FILE , "rb" ) as file :
90+ reader = Reader ("image/jpeg" , file )
91+ self .assertIsNone (reader .get_active_manifest ())
92+
8893 def test_get_manifest_from_label (self ):
8994 with open (self .testPath , "rb" ) as file :
9095 reader = Reader ("image/jpeg" , file )
@@ -98,6 +103,15 @@ def test_get_manifest_from_label(self):
98103 active_manifest = reader .get_active_manifest ()
99104 self .assertEqual (manifest , active_manifest )
100105
106+ def test_get_manifest_from_label_no_manifest (self ):
107+ with open (INGREDIENT_TEST_FILE , "rb" ) as file :
108+ reader = Reader ("image/jpeg" , file )
109+
110+ # Test getting manifest by the specific label
111+ label = "contentauth:urn:uuid:c85a2b90-f1a0-4aa4-b17f-f938b475804e"
112+ manifest = reader .get_manifest_from_label (label )
113+ self .assertIsNone (manifest )
114+
101115 def test_stream_get_non_active_manifest_by_label (self ):
102116 video_path = os .path .join (FIXTURES_DIR , "video1.mp4" )
103117 with open (video_path , "rb" ) as file :
@@ -184,6 +198,11 @@ def test_stream_read_filepath_as_stream_and_parse(self):
184198 title = manifest_store ["manifests" ][manifest_store ["active_manifest" ]]["title" ]
185199 self .assertEqual (title , DEFAULT_TEST_FILE_NAME )
186200
201+ def test_read_no_manifest_context_manager (self ):
202+ with Reader ("image/jpeg" , INGREDIENT_TEST_FILE ) as reader :
203+ self .assertIsNone (reader .json ())
204+ self .assertIsNone (reader .get_active_manifest ())
205+
187206 def test_reader_double_close (self ):
188207 with open (self .testPath , "rb" ) as file :
189208 reader = Reader ("image/jpeg" , file )
0 commit comments