Esempio n. 1
0
 def get_summary_patch_response(self, user, summary=None):
     if summary is None:
         summary = self.summary
     url = self.base_url + f'{summary.id}/'
     data = {'summary': 'A patch update'}
     response = get_authenticated_patch_response(
         user, url, data, content_type='application/json')
     return response
 def get_reply_patch_response(self, user, text):
     url, data = self.get_request_config('reply', text)
     response = get_authenticated_patch_response(
         user,
         url,
         data,
         content_type='application/json'
     )
     return response
Esempio n. 3
0
 def get_patch_response(self, user, paper):
     if paper is None:
         paper = self.paper
     url = self.base_url + f'{paper.id}/'
     data = {'title': 'Patched Paper Title'}
     response = get_authenticated_patch_response(
         user,
         url,
         data,
         content_type='multipart/form-data'
     )
     return response
Esempio n. 4
0
    def test_set_has_seen_first_coin_modal(self):
        user = create_random_authenticated_user('first_coin_viewser')
        self.assertFalse(user.has_seen_first_coin_modal)

        url = '/api/user/has_seen_first_coin_modal/'
        response = get_authenticated_patch_response(
            user, url, data={}, content_type='application/json')
        self.assertContains(response,
                            'has_seen_first_coin_modal":true',
                            status_code=200)

        user.refresh_from_db()
        self.assertTrue(user.has_seen_first_coin_modal)
 def get_patch_response(self, user, bullet_point_id, data):
     url = self.base_url + str(bullet_point_id) + '/'
     response = get_authenticated_patch_response(
         user, url, data, content_type='application/json')
     return response