Browse Source

Prepare to write unit tests

pull/12/merge
Sheng 7 years ago
parent
commit
09d5804a09
  1. 13
      .coveragerc
  2. 1
      .gitignore
  3. 20
      .travis.yml
  4. 12
      README.md
  5. 2
      requirements.txt
  6. 0
      tests/__init__.py
  7. 0
      webssh/__init__.py
  8. 0
      webssh/handler.py
  9. 0
      webssh/main.py
  10. 0
      webssh/policy.py
  11. 0
      webssh/preview/login.png
  12. 0
      webssh/preview/terminal.png
  13. 0
      webssh/settings.py
  14. 0
      webssh/static/css/bootstrap.min.css
  15. 0
      webssh/static/css/fullscreen.min.css
  16. 0
      webssh/static/css/xterm.min.css
  17. 0
      webssh/static/img/favicon.png
  18. 0
      webssh/static/js/bootstrap.min.js
  19. 0
      webssh/static/js/fullscreen.min.js
  20. 0
      webssh/static/js/jquery.min.js
  21. 0
      webssh/static/js/main.js
  22. 0
      webssh/static/js/popper.min.js
  23. 0
      webssh/static/js/xterm.min.js
  24. 0
      webssh/templates/index.html
  25. 0
      webssh/worker.py

13
.coveragerc

@ -0,0 +1,13 @@
[run]
branch = true
source = webssh
[report]
exclude_lines =
if self.debug:
pragma: no cover
raise NotImplementedError
if __name__ == .__main__.:
ignore_errors = True
omit =
tests/*

1
.gitignore vendored

@ -36,6 +36,7 @@ htmlcov/
.tox/ .tox/
.coverage .coverage
.cache .cache
.pytest_cache/
nosetests.xml nosetests.xml
coverage.xml coverage.xml

20
.travis.yml

@ -0,0 +1,20 @@
dist: trusty
sudo: false
language: python
python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
install:
- pip install -r requirements.txt
- pip install pytest pytest-cov codecov flake8
script:
- pytest --cov=webssh
- flake8 --exclude='.git'
after_success:
- codecov

12
README.md

@ -1,5 +1,9 @@
## WebSSH ## WebSSH
A simple web application to be used as an ssh client to connect to your ssh servers. It is written in Python, base on Tornado and Paramiko. [![Build Status](https://travis-ci.org/huashengdun/webssh.svg?branch=master)](https://travis-ci.org/huashengdun/webssh)
[![codecov](https://codecov.io/gh/huashengdun/webssh/branch/master/graph/badge.svg)](https://codecov.io/gh/huashengdun/webssh)
![license](https://img.shields.io/github/license/mashape/apistatus.svg)
A simple web application to be used as an ssh client to connect to your ssh servers. It is written in Python, base on tornado and paramiko.
### Preview ### Preview
![Login](https://github.com/huashengdun/webssh/raw/master/preview/login.png) ![Login](https://github.com/huashengdun/webssh/raw/master/preview/login.png)
@ -18,7 +22,7 @@ A simple web application to be used as an ssh client to connect to your ssh serv
git clone https://github.com/huashengdun/webssh.git git clone https://github.com/huashengdun/webssh.git
cd webssh cd webssh
pip install -r requirements.txt pip install -r requirements.txt
python main.py python webssh/main.py
``` ```
### Options ### Options
@ -41,7 +45,7 @@ python main.py --help
### Nginx config example for running this app behind an nginx server ### Nginx config example for running this app behind an nginx server
``` ```
location / { location / {
proxy_pass http://127.0.0.1:8888; proxy_pass http://127.0.0.1:8888;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_read_timeout 300; proxy_read_timeout 300;
@ -50,7 +54,7 @@ location / {
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port; proxy_set_header X-Real-PORT $remote_port;
} }
``` ```
### Tips ### Tips

2
requirements.txt

@ -1,2 +1,2 @@
paramiko==2.4.1 paramiko==2.4.1
tornado==5.0.1 tornado==5.0.2

0
tests/__init__.py

0
webssh/__init__.py

0
handler.py → webssh/handler.py

0
main.py → webssh/main.py

0
policy.py → webssh/policy.py

0
preview/login.png → webssh/preview/login.png

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

0
preview/terminal.png → webssh/preview/terminal.png

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 83 KiB

0
settings.py → webssh/settings.py

0
static/css/bootstrap.min.css → webssh/static/css/bootstrap.min.css vendored

0
static/css/fullscreen.min.css → webssh/static/css/fullscreen.min.css vendored

0
static/css/xterm.min.css → webssh/static/css/xterm.min.css vendored

0
static/img/favicon.png → webssh/static/img/favicon.png

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

0
static/js/bootstrap.min.js → webssh/static/js/bootstrap.min.js vendored

0
static/js/fullscreen.min.js → webssh/static/js/fullscreen.min.js vendored

0
static/js/jquery.min.js → webssh/static/js/jquery.min.js vendored

0
static/js/main.js → webssh/static/js/main.js

0
static/js/popper.min.js → webssh/static/js/popper.min.js vendored

0
static/js/xterm.min.js → webssh/static/js/xterm.min.js vendored

0
templates/index.html → webssh/templates/index.html

0
worker.py → webssh/worker.py

Loading…
Cancel
Save