Welcome to the AirBnB clone project! - The console
First step: Write a command interpreter to manage your AirBnB objects. This is the first step towards building your first full web application: the AirBnB clone. This first step is very important because you will use what you build during this project with all other following projects: HTML/CSS templating, database storage, API, front-end integration e.t.c
Each task is linked and will help you to:
put in place a parent class (called BaseModel) to take care of the initialization, serialization and deserialization of your future instances create a simple flow of serialization/deserialization: Instance <-> Dictionary <-> JSON string <-> file
create all classes used for AirBnB (User, State, City, Place…) that inherit from BaseModel create the first abstracted storage engine of the project: File storage. create all unittests to validate all our classes and storage engine
The console works both in interactive mode and non-interactive mode, much like a Unix shell. It prints a prompt (hbnb) and waits for the user for input.
Command | Example |
---|---|
Run the console | ./console.py |
Quit the console | (hbnb) quit |
Display the help for a command | (hbnb) help <command> |
Create an object (prints its id) | (hbnb) create <class> |
Show an object | (hbnb) show <class> <id> or (hbnb) <class>.show(<id>) |
Destroy an object | (hbnb) destroy <class> <id> or (hbnb) <class>.destroy(<id>) |
Show all objects, or all instances of a class | (hbnb) all or (hbnb) all <class> |
Update an attribute of an object | (hbnb) update <class> <id> <attribute name> "<attribute value>" or (hbnb) <class>.update(<id>, <attribute name>, "<attribute value>") |
$ ./console.py
(hbnb) help
Documented commands (type help <topic>):
========================================
EOF help quit
(hbnb)
(hbnb)
(hbnb) quit
$
$ echo "help" | ./console.py
(hbnb)
Documented commands (type help <topic>):
========================================
EOF help quit
(hbnb)
$
$ cat test_help
help
$
$ cat test_help | ./console.py
(hbnb)
Documented commands (type help <topic>):
========================================
EOF help quit
(hbnb)
$
Unittests for the HolbertonBnB project are defined in the tests folder. To run the entire test suite simultaneously, execute the following command:
$ python3 unittest -m discover tests
Alternatively, you can specify a single test file to run at a time:
$ python3 unittest -m tests/test_console.py
- Abraham Paul <ZeusMadeIt>
- Wesam Eldeeb <wesam-c>