<commit_before>import sys
sys.path.append('/home/vagrant/personal/new_simi')

from core.tests import AppTestCase
from core.tests import requests

from core import exceptions as local_exc

import json

DOMAIN = 'http://vagrant.intra.douban.com:8000'


class TestLogin(AppTestCase):
    test_url = DOMAIN + '/login/'

    def test_post(self):
        json_content = {'cell_phone': 13667148901, 'password': '<PASSWORD>'}
        response = requests.post(self.test_url, data=json.dumps(json_content))
        self.assertEqual(response.status_code, 200)


class TestUsers(AppTestCase):
    test_url = DOMAIN + '/user/'

    def test_post(self):
        json_content = {'cell_phone': 13667148902, 'password': '<PASSWORD>'}
        response = requests.post(self.test_url, data=json.dumps(json_content))
        self.assertEqual(response.status_code, 200)
        self.assertIn('access_token', response.json.keys())
        self.assertIn('url', response.json.keys())

    def test_get(self):
        response = requests.get(self.test_url)
        self.assertEqual(response.status_code, 200)


class TestUser(AppTestCase):
    test_url = DOMAIN + '/user/1/'

    def test_get(self):
        response = requests.get(self.test_url)
        self.assertEqual(200, response.status_code)
        user_dict = response.json
        self.assertEqual(user_dict['cell_phone'], '13667148900')

    def test_put(self):
        json_content = {'name': 'yuanbowen', 'email': '<EMAIL>'}
        response = requests.put(self.test_url, data=json.dumps(json_content))
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.json['name'], 'yuanbowen')
        self.assertEqual(response.json['email'], '<EMAIL>')


class TestCirlces(AppTestCase):
    test_url = DOMAIN + '/circle/'

    def test_post(self):
        headers = {'Authorization': '<KEY>'}
        json_content = {'name': 'fucking girl', 'description': 'fucking girl'}
        response = requests.post(self.test_url, data=json.dumps(json_content),
                                 headers=headers)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.json['name'], 'fucking girl')


class TestCircle(AppTestCase):
    test_url = DOMAIN + '/circle/1/'

    def test_get(self):
        headers = {'Authorization': '<KEY>'}
        response = requests.get(self.test_url, headers=headers)
        self.assertEqual(response.status_code, 200)
        headers = {'Authorization': '<KEY>'}
        response = requests.get(self.test_url, headers=headers)
        self.assertEqual(response.status_code, 403)

    def test_put(self):
        headers = {'Authorization': '<KEY>'}
        json_content = {'name': 'fuck man', 'description': 'fuck boy'}
        response = requests.put(
            self.test_url, headers=headers, data=json.dumps(json_content))
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.json['name'], 'fuck man')
        self.assertEqual(response.json['description'], 'fuck boy')


class TestCircleStatus(AppTestCase):
    test_url = DOMAIN + '/circle/1/status/'

    def test_get(self):
        headers = {'Authorization': '<KEY>'}
        response = requests.get(self.test_url, headers=headers)
        self.assertEqual(response.status_code, 200)

    def test_post(self):
        headers = {'Authorization': '<KEY>'}
        json_content = {'content': 'this is the first fuck'}
        response = requests.post(self.test_url, headers=headers,
                                 data=json.dumps(json_content))
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.json['content'], 'this is the first fuck')


class TestCircleMember(AppTestCase):
    test_url = DOMAIN + '/circle/1/member/'

    def test_get(self):
        headers = {'Authorization': '<KEY>'}
        response = requests.get(self.test_url, headers=headers)
        self.assertEqual(response.status_code, 200)

    def test_post(self):
        headers = {'authorization': '<KEY>'}
        json_content = {'member_id': 2}
        response = requests.post(self.test_url, headers=headers,
                                 data=json.dumps(json_content))
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.json['member_id'], 2)
        self.assertEqual(response.json['status'], 1)
        print response.json


class TestCircleMemberDetail(AppTestCase):
    test_url = DOMAIN + '/circle/1/member/2/'

    def test_get(self):
        headers = {'authorization': '<KEY>'}
        response = requests.get(self.test_url, headers=headers)
        self.assertEqual(response.status_code, 200)

    def test_put(self):
        headers = {'authorization': '<KEY>'}
        json_content = {'status': 2}
        response = requests.put(self.test_url, headers=headers,
                                data=json.dumps(json_content))
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.json['status'], 2)<commit_msg>[Updatee] Update requests new api     json() instead of json property<commit_after>import sys
sys.path.append('/home/vagrant/personal/new_simi')

from core.tests import AppTestCase
from core.tests import requests

from core import exceptions as local_exc

import json

DOMAIN = 'http://vagrant.intra.douban.com:8000'


class TestLogin(AppTestCase):
    test_url = DOMAIN + '/login/'

    def test_post(self):
        json_content = {'cell_phone': 13667148901, 'password': '<PASSWORD>'}
        response = requests.post(self.test_url, data=json.dumps(json_content))
        self.assertEqual(response.status_code, 200)


class TestUsers(AppTestCase):
    test_url = DOMAIN + '/user/'

    def test_post(self):
        json_content = {'cell_phone': 13667148902, 'password': '<PASSWORD>'}
        response = requests.post(self.test_url, data=json.dumps(json_content))
        self.assertEqual(response.status_code, 200)
        self.assertIn('access_token', response.json().keys())
        self.assertIn('url', response.json().keys())

    def test_get(self):
        response = requests.get(self.test_url)
        self.assertEqual(response.status_code, 200)


class TestUser(AppTestCase):
    test_url = DOMAIN + '/user/1/'

    def test_get(self):
        response = requests.get(self.test_url)
        self.assertEqual(200, response.status_code)
        user_dict = response.json()
        self.assertEqual(user_dict['cell_phone'], '13667148900')

    def test_put(self):
        json_content = {'name': 'yuanbowen', 'email': '<EMAIL>'}
        response = requests.put(self.test_url, data=json.dumps(json_content))
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.json()['name'], 'yuanbowen')
        self.assertEqual(response.json()['email'], '<EMAIL>')


class TestCirlces(AppTestCase):
    test_url = DOMAIN + '/circle/'

    def test_post(self):
        headers = {'Authorization': '<KEY>'}
        json_content = {'name': 'fucking girl', 'description': 'fucking girl'}
        response = requests.post(self.test_url, data=json.dumps(json_content),
                                 headers=headers)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.json()['name'], 'fucking girl')


class TestCircle(AppTestCase):
    test_url = DOMAIN + '/circle/1/'

    def test_get(self):
        headers = {'Authorization': '<KEY>'}
        response = requests.get(self.test_url, headers=headers)
        self.assertEqual(response.status_code, 200)
        headers = {'Authorization': '<KEY>'}
        response = requests.get(self.test_url, headers=headers)
        self.assertEqual(response.status_code, 403)

    def test_put(self):
        headers = {'Authorization': '<KEY>'}
        json_content = {'name': 'fuck man', 'description': 'fuck boy'}
        response = requests.put(
            self.test_url, headers=headers, data=json.dumps(json_content))
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.json()['name'], 'fuck man')
        self.assertEqual(response.json()['description'], 'fuck boy')


class TestCircleStatus(AppTestCase):
    test_url = DOMAIN + '/circle/1/status/'

    def test_get(self):
        headers = {'Authorization': '<KEY>'}
        response = requests.get(self.test_url, headers=headers)
        self.assertEqual(response.status_code, 200)

    def test_post(self):
        headers = {'Authorization': '<KEY>'}
        json_content = {'content': 'this is the first fuck'}
        response = requests.post(self.test_url, headers=headers,
                                 data=json.dumps(json_content))
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.json()['content'], 'this is the first fuck')


class TestCircleMember(AppTestCase):
    test_url = DOMAIN + '/circle/1/member/'

    def test_get(self):
        headers = {'Authorization': '<KEY>'}
        response = requests.get(self.test_url, headers=headers)
        self.assertEqual(response.status_code, 200)

    def test_post(self):
        headers = {'authorization': '<KEY>'}
        json_content = {'member_id': 2}
        response = requests.post(self.test_url, headers=headers,
                                 data=json.dumps(json_content))
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.json()['member_id'], 2)
        self.assertEqual(response.json()['status'], 1)


class TestCircleMemberDetail(AppTestCase):
    test_url = DOMAIN + '/circle/1/member/2/'

    def test_get(self):
        headers = {'authorization': '<KEY>'}
        response = requests.get(self.test_url, headers=headers)
        self.assertEqual(response.status_code, 200)

    def test_put(self):
        headers = {'authorization': '<KEY>'}
        json_content = {'status': 2}
        response = requests.put(self.test_url, headers=headers,
                                data=json.dumps(json_content))
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.json()['status'], 2)
{'fraction_non_alphanumeric': 0.13742050874403816, 'fraction_numerical': 0.018481717011128777, 'mean_word_length': 3.123310118803769, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7170502', 'n_tokens_mistral': 3123, 'n_tokens_neox': 2934, 'n_words': 556}