forked from justinmajetich/AirBnB_clone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/justinmajetich/AirBnB_clone
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,30 @@ | ||
#!/usr/bin/python3 | ||
import unittest | ||
from unittest.mock import patch | ||
from io import StringIO | ||
from console import HBNBCommand | ||
""" Module for console tests """ | ||
|
||
|
||
class test_console(unittest.TestCase): | ||
""" Tests for the console """ | ||
|
||
def test_help(self): | ||
with unittest.mock.patch('sys.stdout', new=StringIO()) as f: | ||
HBNBCommand().onecmd("help") | ||
c = f.getvalue() | ||
self.assertEqual(c, f.getvalue()) | ||
|
||
def test_create(self): | ||
with unittest.mock.patch('sys.stdout', new=StringIO()) as f: | ||
HBNBCommand().onecmd("create BaseModel") | ||
c = f.getvalue() | ||
self.assertEqual(c, f.getvalue()) | ||
|
||
def test_show(self): | ||
with unittest.mock.patch('sys.stdout', new=StringIO()) as f: | ||
HBNBCommand().onecmd("create BaseModel") | ||
c = f.getvalue() | ||
HBNBCommand().onecmd("update BaseModel {}".format(c)) | ||
c = f.getvalue() | ||
self.assertEqual(c, f.getvalue()) |