Ejemplo n.º 1
0
    def test_NotAdminCantSeeSecretCatalog(self):
        response = requests.get(url + '/secretCatalog')
        self.assertEqual(response.status_code, 500)

        guest_session = getLoggedSession('*****@*****.**', '123')
        response = guest_session.get(url + '/secretCatalog')
        self.assertEqual(response.url, url + '/')
Ejemplo n.º 2
0
 def test_buyNormalItemsCount(self):
     ls = getLoggedSession()
     response = buyItem(ls, 1, 1).json()
     self.assertEqual('OK', response['result'])
Ejemplo n.º 3
0
 def test_removeFromCartInvalidItem(self):
     ls = getLoggedSession()
     response = removeFromCart(ls, 'str').json()
     self.assertEqual('Bad Number', response['result']['text'])
Ejemplo n.º 4
0
 def test_removeFromCartAddedItem(self):
     ls = getLoggedSession()
     buyItem(ls, 1, 10)
     response = removeFromCart(ls, 1).json()
     self.assertEqual(response["result"], 'OK')
Ejemplo n.º 5
0
 def test_incorrectBuyItems(self):
     ls = getLoggedSession()
     test_cases = [[0, 1], [1, -11], [1, 'asd'], ['asd', 1]]
     for item in test_cases:
         response = buyItem(ls, item[0], item[1]).json()
         self.assertEqual('Bad number', response['result']['text'])
Ejemplo n.º 6
0
 def test_buyItemsTwice(self):
     ls = getLoggedSession()
     buyItem(ls, 1, 10)
     json_resp = buyItem(ls, 1, 20).json()
     self.assertEqual('OK', json_resp['result'])
Ejemplo n.º 7
0
 def test_AdminCanSeeSecterCatalog(self):
     logged_session = getLoggedSession()
     response = logged_session.get(url + '/secretCatalog')
     self.assertEqual(response.status_code, 200)