Coder Social home page Coder Social logo

airbnb_clone's Introduction

0x00. AirBnB clone - The Console

Project Description


The console is the first of all the AirBnB clone projects. The goal of this project is to: - Create a data model - Manage (create, update, destroy, etc) objects via a console / command interpreter - Store and persist objects to a file (JSON file)

Command Interpreter description


The command interpreter is like a CLI with specific commands like the AirBnB website. It is how we would interact with our project like a user interface (front-end)

- How to start it?

Installation


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

cd into directory and run "console.py"

How to use it?

Use the commands given:

  • Create: create CLASS

    • Creates a new object and saves it
  • Show: show CLASS ID

    • Displays a specific object
  • Destroy: destroy CLASS ID

    • Destroys a specific object
  • All: all [CLASS]

    • Displays all objects in storage (of a particular class or the entire storage)
  • Update: update CLASS ID NAME

    • Updates attributes of a specific object

Authors


Isaac Edzie Edzie Madoks Dokubo


Storage

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

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)


### Documentation

* Modules:

```python
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

airbnb_clone's People

Contributors

ommienu avatar madokscharles avatar

Watchers

 avatar

Forkers

madokscharles

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.