Project attempts to clone the the AirBnB application and website, including the database, storage, RESTful API, Web Framework, and Front End.
- OS: Ubuntu 14.04 LTS
- language: Python 3.4.3
- style: PEP 8 (v. 1.7.0)
To run the console, clone this repository and run ./console.py
Once in the console, you will see the following:
.----------------------------.
| Welcome to hbnb CLI! |
| for help, input 'help' |
| for quit, input 'quit' |
.----------------------------.
(hbnb)
Allowed commands can be shown by running help
:
(hbnb) help
Documented commands (type help <topic>):
========================================
Amenity City Place State airbnb create help show
BaseModel EOF Review User all destroy quit update
- Usage:
airbnb
- Usage:
all <class name>
- Usage:
create <class name>
- Usage:
destroy <class name> <instance id>
- Usage:
EOF
- To list the available commands:
help
- To show details about a specific command:
help <command>
- Usage:
quit
- Usage:
show <class name> <instance id>
- Usage:
update <class name> <instance id> <attribute name> <value of attribute>
Each Class has various methods that can be run on an instance of that Class.
The syntax to run Class methods is <Class name>.<comand>(<instance id>)
.
Classes available: Amenity
, BaseModel
, City
, Place
, Review
, State
, User
Commands available:
save
: Updates attribute "updated_at" to the current time, saves the instanceto_json
: Returns JSON representation of the instancedelete
: Deletes an instance from storage
This project uses python library, unittest
to run tests on all python files.
All unittests are in the ./tests
directory with the command:
python3 -m unittest discover -v ./tests/
The bash script init_test.sh
executes all these tests:
-
checks
pep8
style -
runs all unittests
-
runs all w3c_validator tests
-
cleans up all
__pycache__
directories and the storage file,file.json
Usage:
$ ./dev/init_test.sh
This project uses python library, cmd
to run tests in an interactive command
line interface. To begin tests with the CLI, run this script:
$ ./console.py
- For a detailed description of all tests, run these commands inside the custom CLI:
$ ./console.py
(hbnb) help help
List available commands with "help" or detailed help with "help cmd".
(hbnb) help
Documented commands (type help <topic>):
========================================
Amenity City Place State airbnb create help show
BaseModel EOF Review User all destroy quit update
(hbnb) help User
class method with .function() syntax
Usage: User.<command>(<id>)
(hbnb) help create
create: create [ARG]
ARG = Class Name
SYNOPSIS: Creates a new instance of the Class from given input ARG
-
Tests in the CLI may also be executed with this syntax:
-
destroy:
<class name>.destroy(<id>)
-
update:
<class name>.update(<id>, <attribute name>, <attribute value>)
-
update with dictionary:
<class name>.update(<id>, <dictionary representation>)
-
Uses Travis-CI to run all tests on all commits to the github repo
- MJ Johnson, mj31508
- David John Coleman II, davidjohncoleman.com
- Kimberly Wong, kjowong | @kjowong | kjowong@gmail.com
- Carrie Ybay, hicarrie | @hicarrie_
- Kristen Loyd, KRLoyd | @Biebop1
Public Domain, no copyright protection