示例#1
0
def test_roomIsMeeting():
    r1 = r.Room([])
    r1.AddObject("table_table1")
    r1.AddObject("chair_chair1")
    r1.AddObject("chair_chair2")
    r1.AddObject("chair_chair3")
    assert r1.GetRoomType() == r.RoomType.meeting
示例#2
0
def test_roomIsGeneric():
    r1 = r.Room([])
    r1.AddObject("table_table1")
    r1.AddObject("chair_chair1")
    r1.AddObject("chair_chair2")
    r1.AddObject("book_book2")
    assert r1.GetRoomType() == r.RoomType.generic
示例#3
0
        def __initRooms():
            # Creates the rooms
            tunnels = []
            for i in range(0, NUMBER_OF_ROOMS):
                roomList.put(Room(i))
                tunnels += [i]

            # Connect the rooms
            shuffle(tunnels)
            for index_east in range(0, NUMBER_OF_ROOMS):
                room = roomList.get(tunnels[index_east])
                index_west = index_east

                if index_east + 1 == len(tunnels):
                    index_east = -1

                room.setEast(roomList.get(tunnels[index_east + 1]))
                room.setWest(roomList.get(tunnels[index_west - 1]))

            shuffle(tunnels)
            for index_north in range(0, NUMBER_OF_ROOMS):
                room = roomList.get(tunnels[index_north])
                index_south = index_north
                if index_north + 1 == len(tunnels):
                    index_north = -1

                room.setNorth(roomList.get(tunnels[index_north + 1]))
                room.setSouth(roomList.get(tunnels[index_south - 1]))
示例#4
0
def test_Room():
    r1 = r.Room([])
    assert r1.objects == []
    r1.AddObject("person_Maria")
    assert r1.objects[0].GetCategory() == rObject.Category.person
示例#5
0
def test_roomIsDouble():
    r1 = r.Room([])
    r1.AddObject("bed_bed1")
    r1.AddObject("bed_bed2")
    assert r1.GetRoomType() == r.RoomType.double
示例#6
0
def test_roomIsSingle():
    r1 = r.Room([])
    r1.AddObject("bed_bed1")
    assert r1.GetRoomType() == r.RoomType.single
示例#7
0
def test_roomIsNotOccupied():
    r1 = r.Room([])
    r1.AddObject("bed_bed1")
    assert not r1.IsOccupied()
示例#8
0
def test_roomIsOccupied():
    r1 = r.Room([])
    r1.AddObject("person_Maria")
    assert r1.IsOccupied()
示例#9
0
def test_duplicateItems():
    r1 = r.Room([])
    assert not r1.objects
    r1.AddObject("person_Maria")
    r1.AddObject("person_Maria")
    assert len(r1.objects) == 1
示例#10
0
文件: index.py 项目: RTae/new-hotel
from flask import Flask, jsonify, request
from flask_cors import CORS, cross_origin
from src import Customer as C
from src import Auth as Au
from src import Room as R
from src import Invoice as I
from src import Receipt as Re
from src import Employee as E
from src import Cleaning as Cl

app = Flask(__name__)
CORS(app)

Customer = C.Customer()
Auth = Au.Auth()
Room = R.Room()
Invoice = I.Invoice()
Receipt = Re.Receipt()
Employee = E.Employee()
Cleaning = Cl.Cleaning()


@app.route('/')
@cross_origin()
def home():
    return 'This is backend new-hotel'


# Customer
# createCustomer use for create customer
@app.route('/customer', methods=["POST"])