def status(self, env, start_response): """Get the status of a carts tar file""" resp = cart_interface_responses.Responses() uid = fix_cart_uid(env['PATH_INFO']) is_valid = is_valid_uid(uid) if not is_valid: self._response = resp.invalid_uid_error_response( start_response, uid) return self.return_response() cart_utils = Cartutils() status = cart_utils.cart_status(uid) self._response = resp.cart_status_response(start_response, status) return self.return_response()
def test_bad_cart_status(self): """test getting a status of a cart that doesnt exist""" with test_database(SqliteDatabase(':memory:'), (Cart, File)): cart_utils = Cartutils() retval = cart_utils.cart_status('2') self.assertEqual(retval[0], 'error')