0x00. AirBnB clone - The console


0x01 Introduction

Team project to build a clone of AirBnB.

The console is a command interpreter to manage objects abstraction between objects and how they are stored

BaseModel

0x02 Environment

All the development and testing was runned over an operating system Ubuntu 20.04 LTS using programming language Python 3.8.3. The editors used were VIM 8.1.2269, VSCode 1.6.1 and Atom 1.58.0 . Control version using Git 2.25.1.

0x03 Installation

git clone https://github.com/ralexrivero/AirBnB_clone.git

change to the AirBnb directory and run the command:

./console.py

Execution

In interactive mode

$ ./console.py
(hbnb) help

Documented commands (type help <topic>):
========================================
EOF  help  quit

(hbnb) 
(hbnb) 
(hbnb) quit
$

in 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) 
$

0x04 Testing

Documentation

  • 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__)'

Python Unit Tests

  • 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

run test in interactive mode

$ echo "python3 -m unittest discover tests" | bash

0x05 Usage

List of commands and examples usage:

The prompt (hbnb) waits for a command in an infinite loop.

  • help

example:

  • quit

example:

0x06 License

0x07 Contributing

0x08 Todo

0x09 Changelog

0x0A Tests

0x0B Questions

0x0C Conclusion

0x0D References

0x0E Acknowledgements

0x0F History

0x10 Credits

GitHub - ralexrivero/AirBnB_clone at pythonawesome.com
Console to handle object storage using JSON serialization and deserealization. This is a team project to develop a Python3 console that emulates the AirBnb object management. - GitHub - ralexrivero...