Beispiel #1
0
    def get_comments(self, commentid, headers):

        comments_url = parser.get("url", "comments")
        comments_get = requests.get(url=comments_url + "/" + str(commentid),
                                    headers=headers)
        # Verify the status_code
        assert comments_get.status_code is 200, 'Getting comment_id results failed!'

        comments_getresp = json.loads(comments_get.text)
        return comments_getresp
Beispiel #2
0
    def get_posts(self, postid, headers):

        posts_url = parser.get("url", "posts")
        posts_get = requests.get(url=posts_url + "/" + str(postid),
                                 headers=headers)
        # Verify the status_code
        assert posts_get.status_code is 200, 'Getting post_id results failed!'

        posts_getresp = json.loads(posts_get.text)
        return posts_getresp
Beispiel #3
0
 def get_users(self, userid, headers):
     
     users_url = parser.get("url", "users")
     
     users_get = requests.get(url= users_url + "/" + str(userid),
                             headers = headers)
     # Verify the status_code
     assert users_get.status_code is 200, 'Getting userid results failed!'
     
     users_getresp = json.loads(users_get.text)
     return users_getresp
Beispiel #4
0
    def put_comments(self, commentid, headers, payload=None):

        comments_url = parser.get("url", "comments")
        comments_get = requests.get(url=comments_url + "/" + str(commentid),
                                    headers=headers,
                                    json=payload)
        # Verify the status_code
        assert comments_get.status_code is 200, 'Editing comment failed!'

        comments_putresp = json.loads(comments_get.text)
        return comments_putresp
Beispiel #5
0
 def put_users(self, userid, headers, payload=None):
     
     users_url = parser.get("url", "users")
     
     users_get = requests.get(url= users_url + "/" + str(userid),
                             headers = headers,
                              json = payload)
     # Verify the status_code
     assert users_get.status_code is 200, 'Editing user failed!'
     
     users_putresp = json.loads(users_get.text)
     return users_putresp
Beispiel #6
0
    def post_comments(self, headers, payload=None):

        comments_url = parser.get("url", "comments")
        comments_post = requests.post(url=comments_url,
                                      headers=headers,
                                      json=payload)
        print('Posting comments:')
        # Verify the status_code
        assert comments_post.status_code is 201, 'comments creation failed!'

        comments_postresp = json.loads(comments_post.text)
        return comments_postresp
Beispiel #7
0
    def put_posts(self, postid, headers, payload=None):

        posts_url = parser.get("url", "posts")

        posts_get = requests.get(url=posts_url + "/" + str(postid),
                                 headers=headers,
                                 json=payload)
        # Verify the status_code
        assert posts_get.status_code is 200, 'Editing post failed!'

        posts_putresp = json.loads(posts_get.text)
        return posts_putresp
Beispiel #8
0
    def post_posts(self, headers, payload=None):

        posts_url = parser.get("url", "posts")
        posts_post = requests.post(url=posts_url,
                                   headers=headers,
                                   json=payload)
        print('Posting posts.....')
        # Verify the status_code
        assert posts_post.status_code is 201, 'posts creation failed!'

        posts_postresp = json.loads(posts_post.text)
        return posts_postresp
Beispiel #9
0
 def post_users(self, headers, payload=None):
     
     users_url = parser.get("url", "users")
     
     
     users_post = requests.post(url=users_url,
                                headers = headers,
                                json = payload)
     print('Posting Users:')
     # Verify the status_code
     assert users_post.status_code is 201, 'user creation failed!'
     
     users_postresp = json.loads(users_post.text)
     return users_postresp