def test_web_registration(self):
        client = Client()

        with patch.object(GraphAPI, 'get') as graph_get:

            def side_effect(*args, **kwargs):
                if args[0] == 'oauth/access_token':
                    return TEST_GRAPH_ACCESS_TOKEN_RESPONSE
                elif args[0] == 'me':
                    return TEST_GRAPH_ME_RESPONSE

            graph_get.side_effect = side_effect

            client.get(
                path = reverse('home'),
                data = {
                    'code': TEST_AUTH_CODE
                }
            )

        user = User.objects.get(id=1)

        assert TEST_GRAPH_ME_RESPONSE['first_name'] == user.first_name
        assert TEST_GRAPH_ME_RESPONSE['last_name'] == user.last_name
        assert TEST_GRAPH_ME_RESPONSE['link'] == user.extra_data.get('link')
Convert argument to unicode string.
dataset/ETHPy150Open jgorset/fandjango/tests/test_fandjango.py/TestFacebookMultipleMiddleware.test_web_registration--crossover with--dataset/ETHPy150Open nigelsmall/httpstream/httpstream/util.py/ustr