This is a solo project to build a clone (hbnb) of AirBnB for ALX SE Course.
The console is a command interpreter for clone AirBnb Project and it performs the following tasks:
- Creating a new object
- Retriving an object from a file
- Performing operations on objects
- Destroying an object
Classes created are managed by the Storage
engine in the FileStorage
Class.
The following are the enviroment used to design, test and run the clone AirBnB console. All the development and testing was done using these platforms:
- MacOs Ventura 13.6.4 and OS Ubuntu 22.04 LTS
- Python 3.11.2
- VSCode 1.86
- Vim 9.0
- Code version control with Git 2.39.5
- Code hosting via GitHub
- Style guidelines:
git clone https://github.com/evans-manyala/AirBnB_clone.git
Change to the AirBnb
directory and run the command:
./console.py
For the interactive mode
$ ./console.py
(hbnb) help
Documented commands (type help <topic>):
========================================
EOF help quit
(hbnb)
(hbnb)
(hbnb) quit
$
For the Non-interactive mode
$ 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)
$
For all the unit testing, these are defined in the tests
folder.
- Modules:
python3 -c 'print(__import__("my_module").__doc__)'
- Classes:
python3 -c 'print(__import__("my_module").MyClass.__doc__)'
- Functions (inside and outside a class):
python3 -c 'print(__import__("my_module").my_function.__doc__)'
and
python3 -c 'print(__import__("my_module").MyClass.my_function.__doc__)'
- unittest module
- File extension
.py
- Files and folders star with
test_
- Organization:for
models/base.py
, unit tests in:tests/test_models/test_base.py
- Execution command:
python3 -m unittest discover tests
- or:
python3 -m unittest tests/test_models/test_base.py
echo "python3 -m unittest discover tests" | bash
To perform the tests in non-interactive mode, use the command:
python3 -m unittest discover tests```
- Quit the console:
```bash
(hbnb) quit
$