Skip to content

efaeleng/AirBnB_clone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

0x00. AirBnB clone - The console

Group project Python OOP Front-end

0x00.Table of contents

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.

To see the fundamental background of the project visit the Wiki.

The console will perform the following tasks:

  • create a new object
  • retrive an object from a file
  • do operations on objects
  • destroy an object

Storage

All the classes are handled by the Storage engine in the FileStorage Class.

0x02 Environment

Suite CRM terminal python Suite CRM Suite CRM git distributed version control system Github

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/aysuarex/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

All the test are defined in the tests folder.

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

run test in non-interactive mode

To run the tests in non-interactive mode, and discover all the test, you can use the command:

python3 -m unittest discover tests

0x05 Usage

  • Start the console in interactive mode:
$ ./console.py
(hbnb)
  • Use help to see the available commands:
(hbnb) help

Documented commands (type help <topic>):
========================================
EOF  all  count  create  destroy  help  quit  show  update

(hbnb)
  • Quit the console:
(hbnb) quit
$

Commands

The commands are displayed in the following format Command / usage / example with output

  • Create

Creates a new instance of a given class. The class' ID is printed and the instance is saved to the file file.json.

create <class>
  • Show
show <class> <id>
  • Destroy

Deletes an instance of a given class with a given ID. Update the file.json

0x06 Authors

  • Efa-Iwa Eleng
  • Ifeanyi Kasim

About

AirBnB clone - The console

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published