コード例 #1
0
ファイル: tests.py プロジェクト: marcore/pok-eco
class XapiTest(TestCase):   # pylint: disable=too-many-ancestors

    @override_settings(FEATURES={'ENABLE_THIRD_PARTY_AUTH': True})
    def setUp(self):
        super(XapiTest, self).setUp()
        self.tracker = DjangoTracker()
        tracker.register_tracker(self.tracker)
        user = UserFactory.create(username=TEST_USERNAME)
        UserSocialAuth.objects.create(user=user, provider="eco", uid=TEST_UID)
        self.user = user
        self.request = get_request_for_user(user)
        fields = dict(XAPI_BACKEND_CONFIG)
        XapiBackendConfig(**fields).save()
        self.backend = XapiBackend()
        self.tincanwrapper = TinCanWrapper()

    def test_get_actor(self):

        expected_actor = Agent(
            account=AgentAccount(
                home_page="%s?user=%s" % (TEST_HOMEPAGE_URL, TEST_UID),
                name=TEST_UID
            )
        )

        actor = self.backend.get_actor(self.user.id)
        self.assertIsNotNone(actor)
        self.assertEqual(expected_actor, actor)
コード例 #2
0
ファイル: tests.py プロジェクト: marcore/pok-eco
 def setUp(self):
     super(XapiTest, self).setUp()
     self.tracker = DjangoTracker()
     tracker.register_tracker(self.tracker)
     user = UserFactory.create(username=TEST_USERNAME)
     UserSocialAuth.objects.create(user=user, provider="eco", uid=TEST_UID)
     self.user = user
     self.request = get_request_for_user(user)
     fields = dict(XAPI_BACKEND_CONFIG)
     XapiBackendConfig(**fields).save()
     self.backend = XapiBackend()
     self.tincanwrapper = TinCanWrapper()