Example #1
0
    def test_study_patch_request_tags(self):
        # adding test for study_tags_request here as it makes sense to check
        # that the tags were added
        obs = study_tags_request()
        exp = {
            'status': 'success',
            'message': '',
            'tags': {
                'admin': [],
                'user': []
            }
        }
        self.assertEqual(obs, exp)

        obs = study_patch_request('*****@*****.**', 1, 'replace', '/tags',
                                  ['testA', 'testB'])
        exp = {'status': 'success', 'message': ''}
        self.assertEqual(obs, exp)

        obs = study_tags_request()
        exp = {
            'status': 'success',
            'message': '',
            'tags': {
                'admin': [],
                'user': ['testA', 'testB']
            }
        }
        self.assertEqual(obs, exp)

        obs = study_patch_request('*****@*****.**', 2000, 'replace', '/tags',
                                  ['testA', 'testB'])
        exp = {'message': 'Study does not exist', 'status': 'error'}
        self.assertEqual(obs, exp)
Example #2
0
    def test_study_tags_patch_request(self):
        # adding test for study_tags_request here as it makes sense to check
        # that the tags were added
        obs = study_tags_request()
        exp = {
            'status': 'success',
            'message': '',
            'tags': {
                'admin': [],
                'user': []
            }
        }
        self.assertEqual(obs, exp)

        obs = study_tags_patch_request('*****@*****.**', 1, 'replace', '/tags',
                                       ['testA', 'testB'])
        exp = {'status': 'success', 'message': ''}
        self.assertEqual(obs, exp)

        obs = study_tags_request()
        exp = {
            'status': 'success',
            'message': '',
            'tags': {
                'admin': [],
                'user': ['testA', 'testB']
            }
        }
        self.assertEqual(obs, exp)

        # check errors
        obs = study_tags_patch_request('*****@*****.**', 1, 'no-exists',
                                       '/tags', ['testA', 'testB'])
        exp = {
            'message': ('Operation "no-exists" not supported. Current '
                        'supported operations: replace'),
            'status':
            'error'
        }
        self.assertEqual(obs, exp)

        obs = study_tags_patch_request('*****@*****.**', 1, 'replace',
                                       '/tags/na', ['testA', 'testB'])
        exp = {'message': 'Incorrect path parameter', 'status': 'error'}
        self.assertEqual(obs, exp)

        obs = study_tags_patch_request('*****@*****.**', 2, 'replace', '/tags',
                                       ['testA', 'testB'])
        exp = {'message': 'Study does not exist', 'status': 'error'}
        self.assertEqual(obs, exp)

        obs = study_tags_patch_request('*****@*****.**', 1, 'replace', '/na')
        exp = {
            'message': ('Attribute "na" not found. Please, check the '
                        'path parameter'),
            'status':
            'error'
        }
        self.assertEqual(obs, exp)
Example #3
0
    def test_study_tags_patch_request(self):
        # adding test for study_tags_request here as it makes sense to check
        # that the tags were added
        obs = study_tags_request()
        exp = {'status': 'success', 'message': '',
               'tags': {'admin': [], 'user': []}}
        self.assertEqual(obs, exp)

        obs = study_tags_patch_request(
            '*****@*****.**', 1, 'replace', '/tags', ['testA', 'testB'])
        exp = {'status': 'success', 'message': ''}
        self.assertEqual(obs, exp)

        obs = study_tags_request()
        exp = {'status': 'success', 'message': '',
               'tags': {'admin': [], 'user': ['testA', 'testB']}}
        self.assertEqual(obs, exp)

        # check errors
        obs = study_tags_patch_request(
            '*****@*****.**', 1, 'no-exists', '/tags', ['testA', 'testB'])
        exp = {'message': ('Operation "no-exists" not supported. Current '
               'supported operations: replace'), 'status': 'error'}
        self.assertEqual(obs, exp)

        obs = study_tags_patch_request(
            '*****@*****.**', 1, 'replace', '/tags/na', ['testA', 'testB'])
        exp = {'message': 'Incorrect path parameter', 'status': 'error'}
        self.assertEqual(obs, exp)

        obs = study_tags_patch_request(
            '*****@*****.**', 2000, 'replace', '/tags', ['testA', 'testB'])
        exp = {'message': 'Study does not exist', 'status': 'error'}
        self.assertEqual(obs, exp)

        obs = study_tags_patch_request(
            '*****@*****.**', 1, 'replace', '/na')
        exp = {'message': ('Attribute "na" not found. Please, check the '
                           'path parameter'), 'status': 'error'}
        self.assertEqual(obs, exp)
Example #4
0
    def test_study_patch_request_tags(self):
        # adding test for study_tags_request here as it makes sense to check
        # that the tags were added
        obs = study_tags_request()
        exp = {'status': 'success', 'message': '',
               'tags': {'admin': [], 'user': []}}
        self.assertEqual(obs, exp)

        obs = study_patch_request(
            '*****@*****.**', 1, 'replace', '/tags', ['testA', 'testB'])
        exp = {'status': 'success', 'message': ''}
        self.assertEqual(obs, exp)

        obs = study_tags_request()
        exp = {'status': 'success', 'message': '',
               'tags': {'admin': [], 'user': ['testA', 'testB']}}
        self.assertEqual(obs, exp)

        obs = study_patch_request(
            '*****@*****.**', 2000, 'replace', '/tags', ['testA', 'testB'])
        exp = {'message': 'Study does not exist', 'status': 'error'}
        self.assertEqual(obs, exp)