Beispiel #1
0
 def test_should_not_be_able_to_randomize_lists_with_different_payload_iat(
         self):
     sut = self.proxy_url + self.proxy_endpoints.randomize
     front_page_url = self.proxy_url + self.proxy_endpoints.playlist_public
     response = self.get_without_auth_header(front_page_url).json()
     for pl in response:
         playlist = ProxyModel.from_dict(pl)
         playlist.iat = HelperClass.random_int_generator(10)
         body = ProxyModel.to_dict(playlist)
         response = self.post_without_auth_header(sut, body)
         self.assertEqual(400, response.status_code)
Beispiel #2
0
 def test_should_not_be_able_to_randomize_lists_with_different_payload_jwtheader(
         self):
     sut = self.proxy_url + self.proxy_endpoints.randomize
     front_page_url = self.proxy_url + self.proxy_endpoints.playlist_public
     response = self.get_without_auth_header(front_page_url).json()
     for pl in response:
         playlist = ProxyModel.from_dict(pl)
         jwtheader = Jwtheader(HelperClass.random_word_letters_only(4))
         playlist.jwtheader = jwtheader
         body = ProxyModel.to_dict(playlist)
         response = self.post_without_auth_header(sut, body)
         self.assertEqual(400, response.status_code)
Beispiel #3
0
 def test_should_not_be_able_to_randomize_lists_with_different_payload_beverages(
         self):
     sut = self.proxy_url + self.proxy_endpoints.randomize
     front_page_url = self.proxy_url + self.proxy_endpoints.playlist_public
     response = self.get_without_auth_header(front_page_url).json()
     for pl in response:
         playlist = ProxyModel.from_dict(pl)
         playlist.beverages = ['beer', 'beer', 'beer']
         body = ProxyModel.to_dict(playlist)
         response = self.post_without_auth_header(sut, body)
         self.assertEqual(400, response.status_code)
         json_body = response.json()
         self.assertTrue(
             self.validate_string_contains(json_body['message'],
                                           'does not validate'))
Beispiel #4
0
 def test_should_be_able_to_randomize_each_list(self):
     sut = self.proxy_url + self.proxy_endpoints.randomize
     for playlist in self.playlists:
         body = ProxyModel.to_dict(playlist)
         response = self.post_without_auth_header(sut, body)
         print(body)
         self.assertEqual(200, response.status_code)
         self.assertTrue(response.json()['result'] in playlist.beverages)
Beispiel #5
0
 def get_playlists(self):
     sut = self.proxy_url + self.proxy_endpoints.playlist_public
     response = self.get_without_auth_header(sut).json()
     for playlist in response:
         pl = ProxyModel.from_dict(playlist)
         self.playlists.append(pl)