@@ -780,6 +780,60 @@ def test_admin_channel_filter__latest_community_library_submission_status__multi
780780 ],
781781 )
782782
783+ def test_admin_channel_filter__community_library_live (self ):
784+ self .client .force_authenticate (user = self .admin_user )
785+
786+ submission1 = testdata .community_library_submission ()
787+ submission1 .channel .version = 2
788+ submission1 .channel .save ()
789+ submission1 .status = community_library_submission .STATUS_LIVE
790+ submission1 .channel_version = 1
791+ submission1 .save ()
792+
793+ CommunityLibrarySubmission .objects .create (
794+ channel = submission1 .channel ,
795+ channel_version = 2 ,
796+ author = submission1 .author ,
797+ status = community_library_submission .STATUS_PENDING ,
798+ )
799+
800+ other_channel_submission = testdata .community_library_submission ()
801+ other_channel_submission .status = community_library_submission .STATUS_PENDING
802+ other_channel_submission .save ()
803+
804+ response = self .client .get (
805+ reverse_with_query (
806+ "admin-channels-list" ,
807+ query = {"community_library_live" : True },
808+ ),
809+ format = "json" ,
810+ )
811+ self .assertEqual (response .status_code , 200 , response .content )
812+ self .assertCountEqual (
813+ [ch ["id" ] for ch in response .data ],
814+ [submission1 .channel .id ],
815+ )
816+
817+ def test_admin_channel_filter__has_community_library_submission (self ):
818+ self .client .force_authenticate (user = self .admin_user )
819+
820+ submission = testdata .community_library_submission ()
821+
822+ testdata .channel () # Another channel without submission
823+
824+ response = self .client .get (
825+ reverse_with_query (
826+ "admin-channels-list" ,
827+ query = {"has_community_library_submission" : True },
828+ ),
829+ format = "json" ,
830+ )
831+ self .assertEqual (response .status_code , 200 , response .content )
832+ self .assertCountEqual (
833+ [ch ["id" ] for ch in response .data ],
834+ [submission .channel .id ],
835+ )
836+
783837 def test_create_channel (self ):
784838 user = testdata .user ()
785839 self .client .force_authenticate (user = user )
0 commit comments