def test_get_all_app_info_bad_tag(self):
     bad_tags = [None, [], {}, "foo", 5, -3]
     for t in bad_tags:
         with self.assertRaises(ValueError) as e:
             get_all_app_info(t, self.user_id, self.nmsURL, self.catalogURL)
         self.assertIn("tag must be one of 'release', 'beta', or 'dev'",
                       str(e.exception))
    def get_all_app_info(self, ctx, input):
        """
        This returns all app info from the KBase catalog, formatted in a way to make life easy for the
        Narrative APPS panel on startup.
        :param input: instance of type "GetAppInfoInput" -> structure:
           parameter "tag" of String, parameter "user" of String
        :returns: instance of type "AllAppInfo" (App info ids are all
           lowercase - module/app_id) -> structure: parameter
           "module_versions" of mapping from String to String, parameter
           "categories" of mapping from String to type "CategoryInfo" ->
           structure: parameter "description" of String, parameter "id" of
           String, parameter "name" of String, parameter "parent_ids" of
           String, parameter "tooltip" of String, parameter "ver" of String,
           parameter "app_infos" of mapping from String to mapping from
           String to type "AppInfo" (favorite is optional - if the app is one
           of the user's favorites, this will be the timestamp when it was
           made a favorite.) -> structure: parameter "app_type" of String,
           parameter "authors" of list of String, parameter "categories" of
           list of String, parameter "git_commit_hash" of String, parameter
           "id" of String, parameter "input_types" of list of String,
           parameter "module_name" of String, parameter "name" of String,
           parameter "namespace" of String, parameter "output_types" of list
           of String, parameter "subtitle" of String, parameter "tooltip" of
           String, parameter "ver" of String, parameter "favorite" of Long
        """
        # ctx is the context object
        # return variables are: output
        #BEGIN get_all_app_info
        output = get_all_app_info(input['tag'], input['user'],
                                  self.narrativeMethodStoreURL,
                                  self.catalogURL)
        #END get_all_app_info

        # At some point might do deeper type checking...
        if not isinstance(output, dict):
            raise ValueError('Method get_all_app_info return value ' +
                             'output is not type dict as required.')
        # return the results
        return [output]
 def test_get_all_app_info_unit_ok(self):
     tags = ['release', 'beta', 'dev']
     for t in tags:
         info = get_all_app_info(t, self.user_id, self.nmsURL,
                                 self.catalogURL)
         self._validate_app_info(info)