Exemplo n.º 1
0
 def test_multiple_kw(self):
     """Assert kw_search allows multiple keywords."""
     keywords = ['Python', 'Flask']
     res = connpy.kw_search(keywords)
     self.assertTrue(isinstance(res, dict))
     keywords = (kw for kw in ['Python', 'Flask'])
     res = connpy.kw_search(keywords)
     self.assertTrue(isinstance(res, dict))
Exemplo n.º 2
0
 def test_search_offset(self):
     """Assert search offset works."""
     # Head 2 events.
     res = connpy.kw_search(count=2)
     # Check with offset 1.
     res_offset1 = connpy.kw_search(count=1, offset=2)
     self.assertEqual(
         res['events'][1],
         res_offset1['events'][0],
     )
Exemplo n.º 3
0
 def test_search_configs(self):
     """Assert several search configuration works."""
     # Count ristriction.
     res = connpy.kw_search(count=3)
     self.assertEqual(res['results_returned'], 3)
     # Date setting.
     res = connpy.kw_search(event_date=20130101)
     self.assertTrue(isinstance(res, dict))
     res = connpy.kw_search(event_date=201301)
     self.assertTrue(isinstance(res, dict))
     with self.assertRaises(ValueError):
         res = connpy.kw_search(event_date=2010301)
Exemplo n.º 4
0
 def test_search_events(self):
     """Assert connpass event searching works."""
     res = connpy.kw_search()  # Apply keyword='Python' as default...
     self.assertTrue(isinstance(res, dict))
     res = connpy.kw_search(search_or=True)  # Just check 'or' works.
     self.assertTrue(isinstance(res, dict))