Exemplo n.º 1
0
    def test_users_get(self, client):
        token = create_token()
        res = client.get('/api/users', content_type='application/json')

        if res.status_code != 200:
            raise ValueError(
                'The res.status_code must be 200, please check your code!')
Exemplo n.º 2
0
 def test_user_get_confirmation_valid(self, client):
     token = create_token()
     res = client.get('/api/users/preferences/confirmations/1',
                     headers={'Authorization':'Bearer ' + token},
                     content_type='application/json')
     if res.status_code != 200:
         raise ValueError('The res.status_code must be 200, please check your code')
Exemplo n.º 3
0
 def test_invitations_accept_valid(self, client):
     token = create_token()
     res = client.put('/api/invitations/accept/1',
                     headers={'Authorization':'Bearer ' + token},
                     content_type='application/json')
     res_json = json.loads(res.data)
     if res.status_code != 200:
         raise ValueError('The res.status_code must be 200, please check your code')
Exemplo n.º 4
0
 def test_user_preferences_put_valid(self, client):
     token = create_token()
     data = {
         "preference": "dinner"
     }
     res = client.put('/api/users/preferences/1', data=json.dumps(data),
                     headers={'Authorization':'Bearer ' + token},
                     content_type='application/json')
     if res.status_code != 200:
         raise ValueError('The res.status_code must be 200, please check your code')
Exemplo n.º 5
0
    def test_hiking_get_valid(self, client):
        """class to test third party api zomato"""

        token = create_token()
        res = client.get('/api/recommendation/hiking/2',
                         headers={'Authorization': 'Bearer ' + token},
                         content_type='application/json')

        if res.status_code != 200:
            raise ValueError(
                'The res.status_code must be 200, please check your code')
Exemplo n.º 6
0
 def test_invitations_post_valid(self, client):
     token = create_token()
     data = {
         "invited_id": 5
     }
     res = client.post('/api/invitations', data=json.dumps(data),
                     headers={'Authorization':'Bearer ' + token},
                     content_type='application/json')
     res_json = json.loads(res.data)
     if res.status_code != 200:
         raise ValueError('The res.status_code must be 200, please check your code')
Exemplo n.º 7
0
    def test_invitations_user_decline_event(self, client):
        """
        test invalid reject without token
        """
        token = create_token()
        res = client.delete('/api/invitations/decline/1',
                        headers={'Authorization':'Bearer ' + token},
                        content_type='application/json')

        if res.status_code != 200:
            raise ValueError('The res.status_code must be 200, please check your code')    
Exemplo n.º 8
0
 def test_dates_delete_invalid(self, client):
     token = create_token()
     data = {"date": "22-01-2020"}
     res = client.delete('/api/date',
                         data=json.dumps(data),
                         headers={'Authorization': 'Bearer ' + token},
                         content_type='application/json')
     res_json = json.loads(res.data)
     if res.status_code != 404:
         raise ValueError(
             'The res.status_code must be 200, please check your code')
Exemplo n.º 9
0
 def test_categories_post_valid(self, client):
     token = create_token()
     data = {"preference": "kuntuk", "category": "makan"}
     res = client.post('/api/category',
                       data=json.dumps(data),
                       headers={'Authorization': 'Bearer ' + token},
                       content_type='application/json')
     res_json = json.loads(res.data)
     if res.status_code != 200:
         raise ValueError(
             'The res.status_code must be 200, please check your code')
Exemplo n.º 10
0
 def test_categories_get_valid(self, client):
     token = create_token()
     data = {"category": "makan"}
     res = client.get('/api/category',
                      query_string=data,
                      headers={'Authorization': 'Bearer ' + token},
                      content_type='application/json')
     res_json = json.loads(res.data)
     if res.status_code != 200:
         raise ValueError(
             'The res.status_code must be 200, please check your code')