Exemple #1
0
 def test_name_not_capital(self): 
     
     # Test no link provided and author's last name is not capital
     link = app.generate_amazon_link('Once upon a time', 'John smith','')
     
     self.assertNotEqual(link, 
     'https://www.amazon.co.uk/s?k=Once+upon+a+time+John+Smith&tag=joanna')
Exemple #2
0
 def test_replace_symbol(self): 
     
     # Test no link provided and '&' symbol in the book title
     link = app.generate_amazon_link('Once upon & time', 'John Smith','')
     
     self.assertEqual(link, 
     'https://www.amazon.co.uk/s?k=Once+upon+and+time+John+Smith&tag=joanna')
Exemple #3
0
 def test_no_link(self):
     
      # Test no link provided
     link = app.generate_amazon_link('Once upon a time', 'John Smith','')
     
     self.assertEqual(link, 
     'https://www.amazon.co.uk/s?k=Once+upon+a+time+John+Smith&tag=joanna')
Exemple #4
0
 def test_tag_exists(self):
     
     # Test link that already contains the tag
     link = app.generate_amazon_link('Carrie', 'Stephen King',
     'https://www.amazon.com/Carrie-Stephen-King/dp/0307743667/?tag=joanna')
     
     self.assertEqual(link, 
     'https://www.amazon.com/Carrie-Stephen-King/dp/0307743667/?tag=joanna')
Exemple #5
0
 def test_amazon_endswith_backslash(self):
     
     # Test direct link to product with backlash at the end
     link = app.generate_amazon_link('Carrie', 'Stephen King',
     'https://www.amazon.com/Carrie-Stephen-King/dp/B002C6LIGU/')
     
     self.assertEqual(link, 
     'https://www.amazon.com/Carrie-Stephen-King/dp/B002C6LIGU/?tag=joanna')
Exemple #6
0
 def test_amazon_search_link(self):
     
     # Test link from search
     link = app.generate_amazon_link('Carrie', 'Stephen King',
     'https://www.amazon.com/Carrie-Stephen-King/dp/B002C6LIGU/ref=sr_1_9?crid=36RCLYEH6RIZ2&keywords=carrie+stephen+king&qid=1576674670&s=books&sprefix=carrie+step%2Cstripbooks-intl-ship%2C216&sr=1-9')
     
     self.assertEqual(link, 
     'https://www.amazon.com/Carrie-Stephen-King/dp/B002C6LIGU/ref=sr_1_9?crid=36RCLYEH6RIZ2&keywords=carrie+stephen+king&qid=1576674670&s=books&sprefix=carrie+step%2Cstripbooks-intl-ship%2C216&sr=1-9&tag=joanna')
Exemple #7
0
 def test_direct_amazon_link(self):
     
     # Test direct link to product
     link = app.generate_amazon_link('Carrie', 'Stephen King',
     'https://www.amazon.com/Carrie-Stephen-King/dp/0307743667')
     
     self.assertEqual(link, 
     'https://www.amazon.com/Carrie-Stephen-King/dp/0307743667/?tag=joanna')
Exemple #8
0
 def test_incorrect_author(self):
     
     # Test link with different author and title information
     # Link provided by user should not be re-create (overwritten)
     link = app.generate_amazon_link('Test', 'John Smith',
     'https://www.amazon.com/Carrie-Stephen-King/dp/0307743667')
     
     self.assertEqual(link, 
     'https://www.amazon.com/Carrie-Stephen-King/dp/0307743667/?tag=joanna')