def setUp(self): self.path = os.path.dirname(os.path.realpath(__file__)) json_file = open(self.path + '/test_data/user_feed.json', 'r') json_feed = json_file.read() json_file.close() self.handler = ServiceHandler(model_instance=UserService()) self.feed = simplejson.loads(json_feed)
class TestGithubService(TestCase): """Test the module with fixtures.""" def setUp(self): self.path = os.path.dirname(os.path.realpath(__file__)) json_file = open(self.path + '/test_data/user_feed.json', 'r') json_feed = json_file.read() json_file.close() self.handler = ServiceHandler(model_instance=UserService()) self.feed = simplejson.loads(json_feed) def tearDown(self): pass def test_convert_feed(self): """Test processing of raw atom feed.""" pass def test_convert_date(self): """Test the method for adding the time diff to a date.""" self.assertEqual(self.handler._convert_date(self.feed[0]).hour, 12) def test_convert_date_null_entry(self): """Check a None object is handled correctly.""" self.assertFalse(self.handler._convert_date(None)) def test_convert_date_missing_date(self): """Check we handle a missing date key""" tmp_entry = self.feed[0] del(tmp_entry['created_at']) self.assertFalse(self.handler._convert_date(tmp_entry)) def test_convert_broken_feed(self): """Test we deal with broken atom feeds.""" #items = _convert_feed('user', 'github', '') #self.assertEqual(0, len(items)) pass