test_integration.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:abidria-api 作者: jordifierro 项目源码 文件源码
def test_create_experience_creates_and_returns_experience(self):
        orm_person = ORMPerson.objects.create(username='usr.nm', is_email_confirmed=True)
        orm_auth_token = ORMAuthToken.objects.create(person_id=orm_person.id)
        auth_headers = {'HTTP_AUTHORIZATION': 'Token {}'.format(orm_auth_token.access_token), }
        client = Client()
        response = client.post(reverse('experiences'),
                               {'title': 'Experience title', 'description': 'Some description'},
                               **auth_headers)

        body = json.loads(response.content)
        created_experience = ORMExperience.objects.get(id=body['id'], title='Experience title',
                                                       description='Some description')
        assert created_experience is not None
        assert body == {
                           'id': str(created_experience.id),
                           'title': 'Experience title',
                           'description': 'Some description',
                           'picture': None,
                           'author_id': orm_person.id,
                           'author_username': orm_person.username
                       }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号