Exemplo n.º 1
0
class TestFoursquareViews(TestCase):
    """Test the module with fixtures.
    """

    def setUp(self):
        self.path = os.path.dirname(os.path.realpath(__file__))
        self.handler = ServiceHandler(model_instance=UserService())

    def tearDown(self):
        pass

    def _loadJson(self, name):
        return simplejson.load(file(os.path.join(self.path, 'test_data', name)))

    def test_convert_feed(self):
        """Check we do the right thing for converting
        foursquares feed into ours."""

        results = self.handler._convert_feed(self._loadJson('checkins.json'), date(2011, 07, 19))

        self.assertEqual(len(results), 12)
        
    def test_badges(self):
        """Test we get back the correct urls for a users badges."""
        
        results = self.handler._pick_badges(self._loadJson('badges.json'), 'projectcausal')
        print results
Exemplo n.º 2
0
class TestFoursquareViews(TestCase):
    """Test the module with fixtures.
    """

    def setUp(self):
        self.path = os.path.dirname(os.path.realpath(__file__))
        self.handler = ServiceHandler(model_instance=UserService())

    def tearDown(self):
        pass

    def _loadJson(self, name):
        return simplejson.load(file(os.path.join(self.path, 'test_data', name)))

    def test_convert_feed(self):
        """Check we do the right thing for converting
        foursquares feed into ours."""

        json = self._loadJson('user_history.json')

        since = datetime.strptime('Tue, 01 Feb 11 06:40:17 +0000'.replace(' +0000', ''),
                          '%a, %d %b %y %H:%M:%S')

        results = self.handler._convert_feed(json, since.date())

        self.assertEqual(len(results), 3)
Exemplo n.º 3
0
 def setUp(self):
     self.path = os.path.dirname(os.path.realpath(__file__))
     self.handler = ServiceHandler(model_instance=UserService())