@@ -644,9 +644,6 @@ public function testBitstreamCount()
644
644
$ this ->assertEquals ($ resp ->data ->size , $ expectedSize );
645
645
}
646
646
647
-
648
-
649
-
650
647
/** test item creation and deletion */
651
648
public function testCreateitemDeleteitem ()
652
649
{
@@ -706,8 +703,70 @@ public function testCreateitemDeleteitem()
706
703
$ this ->assertFalse ($ itemDao , 'Item should have been deleted, but was not. ' );
707
704
}
708
705
706
+ /** Test the server info reporting methods */
707
+ public function testInfoMethods ()
708
+ {
709
+ // Test midas.version
710
+ $ this ->params ['method ' ] = 'midas.version ' ;
711
+ $ resp = $ this ->_callJsonApi ();
712
+ $ this ->_assertStatusOk ($ resp );
713
+ $ this ->assertEquals ($ resp ->data ->version , Zend_Registry::get ('configDatabase ' )->version );
714
+
715
+ // Test midas.modules.list
716
+ $ this ->resetAll ();
717
+ $ this ->params ['method ' ] = 'midas.modules.list ' ;
718
+ $ resp = $ this ->_callJsonApi ();
719
+ $ this ->_assertStatusOk ($ resp );
720
+ $ this ->assertNotEmpty ($ resp ->data ->modules );
721
+ $ this ->assertTrue (in_array ('api ' , $ resp ->data ->modules ));
722
+
723
+ // Test midas.methods.list
724
+ $ this ->resetAll ();
725
+ $ this ->params ['method ' ] = 'midas.methods.list ' ;
726
+ $ resp = $ this ->_callJsonApi ();
727
+ $ this ->_assertStatusOk ($ resp );
728
+ $ this ->assertNotEmpty ($ resp ->data ->methods );
729
+ foreach ($ resp ->data ->methods as $ method )
730
+ {
731
+ $ this ->assertNotEmpty ($ method ->name );
732
+ $ this ->assertNotEmpty ($ method ->help );
733
+ $ this ->assertTrue (isset ($ method ->help ->description ));
734
+ $ this ->assertTrue (isset ($ method ->help ->params ));
735
+ $ this ->assertTrue (isset ($ method ->help ->example ));
736
+ $ this ->assertTrue (isset ($ method ->help ->return ));
737
+
738
+ // Test a specific method's params list
739
+ if ($ method ->name == 'login ' )
740
+ {
741
+ $ this ->assertNotEmpty ($ method ->help ->params ->appname );
742
+ $ this ->assertNotEmpty ($ method ->help ->params ->apikey );
743
+ $ this ->assertNotEmpty ($ method ->help ->params ->email );
744
+ }
745
+ }
709
746
747
+ // Test midas.info
748
+ $ this ->resetAll ();
749
+ $ this ->params ['method ' ] = 'midas.info ' ;
750
+ $ resp = $ this ->_callJsonApi ();
751
+ $ this ->_assertStatusOk ($ resp );
710
752
753
+ // We should get version
754
+ $ this ->assertEquals ($ resp ->data ->version , Zend_Registry::get ('configDatabase ' )->version );
711
755
756
+ // We should get modules list
757
+ $ this ->assertNotEmpty ($ resp ->data ->modules );
758
+ $ this ->assertTrue (in_array ('api ' , $ resp ->data ->modules ));
712
759
760
+ // We should get methods list
761
+ $ this ->assertNotEmpty ($ resp ->data ->methods );
762
+ foreach ($ resp ->data ->methods as $ method )
763
+ {
764
+ $ this ->assertNotEmpty ($ method ->name );
765
+ $ this ->assertNotEmpty ($ method ->help );
766
+ $ this ->assertTrue (isset ($ method ->help ->description ));
767
+ $ this ->assertTrue (isset ($ method ->help ->params ));
768
+ $ this ->assertTrue (isset ($ method ->help ->example ));
769
+ $ this ->assertTrue (isset ($ method ->help ->return ));
770
+ }
771
+ }
713
772
}
0 commit comments