def test_pattern(self):
        infoq_client = client.InfoQ(cache_enabled=True)
        summary = presentation.get_summaries(infoq_client).next()

        cmd = self.build_list_cmd(['-p', summary['title']])
        output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
        self.assertEqual(output.count("Id: "), 1)
    def test_summaries_max_pages(self):
        # Check that only one page is fetched
        count = 0
        for summary in presentation.get_summaries(self.iq, filter=presentation.MaxPagesFilter(1)):
            self.assert_valid_summary(summary)
            self.assertLessEqual(count, presentation._RightBarPage.RIGHT_BAR_ENTRIES_PER_PAGES)
            count += 1

        self.assertEqual(count, presentation._RightBarPage.RIGHT_BAR_ENTRIES_PER_PAGES)
 def test_summaries_max_pages(self):
     # Check that only one page is fetched
     count = 0
     for summary in presentation.get_summaries(self.iq, filter=presentation.MaxPagesFilter(1)):
         self.assert_valid_summary(summary)
         # The number of presentation per page to be updated from time to time
         # We expect that the number of presentation will never be greater than
         # this magic number
         self.assertLessEqual(count, 20)
         count += 1
Exemple #4
0
        def main(self, infoq_client, args):
            parser = argparse.ArgumentParser(prog="%s %s %s" % (app_name, PresentationModule.name, PresentationModule.PresentationList.name))
            parser.add_argument('-m', '--max-pages', type=int, default=10,   help='maximum number of pages to retrieve (8 presentations per page)')
            parser.add_argument('-n', '--max-hits' , type=int, default=10,   help='maximum number of hits')
            parser.add_argument('-p', '--pattern'  , type=str, default=None, help='filter hits according to this pattern')
            parser.add_argument('-s', '--short'    , action="store_true",    help='short output, only ids are displayed')
            args = parser.parse_args(args=args)

            filter = PresentationModule.PresentationList._Filter(pattern=args.pattern, max_hits=args.max_hits, max_pages=args.max_pages)
            summaries = presentation.get_summaries(infoq_client, filter=filter)
            if args.short:
                self.__short_output(summaries)
            else:
                self.__standard_output(summaries)

            return 0
 def test_summaries(self):
     summaries = presentation.get_summaries(self.iq)
     for i in xrange(presentation._RightBarPage.RIGHT_BAR_ENTRIES_PER_PAGES + 1):
         summary = summaries.next()
         self.assert_valid_summary(summary)
 def test_summaries(self):
     summaries = presentation.get_summaries(self.iq)
     for i in xrange(12):
         summary = summaries.next()
         self.assert_valid_summary(summary)
def get_latest_presentation(client):
    summary = presentation.get_summaries(client).next()
    return presentation.Presentation(client, summary['id'])