def test_get_products_invalid_token(self):
        """With an invalid token, are correct errors thrown?"""

        # Attempt to get products with invalid token
        self.assertRaises(AuthenticationException,
                          product_service.get_products,
                          utils.get_bad_token())
    def test_get_products_invalid_token(self):
        """With an invalid token, are correct errors thrown?"""

        # Attempt to get products with invalid token
        self.assertRaises(AuthenticationException,
                          product_service.get_products,
                          utils.get_bad_token())
    def test_get_distribution_center_inventory_invalid_token(self):
        """With an invalid token, are correct errors thrown?"""

        # Get distribution centers
        distribution_centers = distribution_center_service.get_distribution_centers(self.loopback_token)
        dc_id = loads(distribution_centers)[0].get('id')

        # Attempt to get retailer inventory with invalid token
        self.assertRaises(AuthenticationException,
                          distribution_center_service.get_distribution_center_inventory,
                          utils.get_bad_token(), dc_id)
Пример #4
0
    def test_delete_shipment_invalid_token(self):
        """With an invalid token, are correct errors thrown?"""

        # Get a specific shipment ID
        shipments = shipment_service.get_shipments(self.loopback_token)
        shipment_id = loads(shipments)[0].get('id')

        # Attempt to delete a shipment with invalid token
        self.assertRaises(AuthenticationException,
                          shipment_service.delete_shipment,
                          utils.get_bad_token(), shipment_id)
Пример #5
0
    def test_get_retailer_invalid_token(self):
        """With an invalid token, are correct errors thrown?"""

        # Get retailers
        retailers = retailer_service.get_retailers(self.loopback_token)
        retailer_id = loads(retailers)[0].get('id')

        # Attempt to get a retailer with invalid token
        self.assertRaises(AuthenticationException,
                          retailer_service.get_retailer, utils.get_bad_token(),
                          retailer_id)
Пример #6
0
    def test_create_shipment_invalid_token(self):
        """With an invalid token, are correct errors thrown?"""

        # Get retailers and distribution centers
        retailers = retailer_service.get_retailers(self.loopback_token)
        distribution_centers = distribution_center_service.get_distribution_centers(
            self.loopback_token)

        # Create shipment
        shipment = dict()
        shipment['fromId'] = loads(distribution_centers)[0].get('id')
        shipment['toId'] = loads(retailers)[0].get('id')
        shipment['estimatedTimeOfArrival'] = "2016-07-14"
        created_shipment = shipment_service.create_shipment(
            self.loopback_token, shipment)

        # Attempt to create a shipment with invalid token
        self.assertRaises(AuthenticationException,
                          shipment_service.create_shipment,
                          utils.get_bad_token(), shipment)
    def test_get_distribution_centers_invalid_token(self):
        """With an invalid token, are correct errors thrown?"""

        self.assertRaises(AuthenticationException,
                          distribution_center_service.get_distribution_centers,
                          utils.get_bad_token())
    def test_user_logout_invalid_token(self):
        """With an invalid token, are correct errors thrown?"""

        self.assertRaises(ResourceDoesNotExistException,
                          user_service.logout,
                          test_utils.get_bad_token())
    def test_user_logout_invalid_token(self):
        """With an invalid token, are correct errors thrown?"""

        self.assertRaises(ResourceDoesNotExistException, user_service.logout,
                          test_utils.get_bad_token())
Пример #10
0
    def test_get_shipments_invalid_token(self):
        """With an invalid token, are correct errors thrown?"""

        self.assertRaises(AuthenticationException,
                          shipment_service.get_shipments,
                          utils.get_bad_token())