コード例 #1
0
 def test_002_directories(self):
     with cd("~"):
         result = run('ls')
         self.assertTrue("sites" in result.split())
     with cd("~/sites"):
         result = run('ls')
         self.assertTrue("todo.gdelo.com" in result.split())
コード例 #2
0
 def test_006_selenium_installed(self):
     "Test Selenium webdriver is installed"
     with cd("~/wendy_workspace"):
         result = run("ls -l")
     with cd("~/wendy_workspace/application/functional_tests"):
         run("ls -l")
         result = run("python3.5 tests.py")
     print(result)
コード例 #3
0
def setup_application():
    with cd("~/workspace"):
        run(setup + 
            "wget https://github.com/hjwp/book-example/archive/chapter_07.zip")
        run(setup + "unzip chapter_07.zip")
        run("mv book-example-chapter_07 application")
    with cd("~/workspace/application"):
        run(setup + "python3 manage.py migrate")
コード例 #4
0
def setup_Xvfb():
    print("Installing pyvirtualdisplay.")
    with cd("~"):
        result = run("sudo apt-get -y install xvfb")
    with cd("~"):
        result = run("sudo pip3 install pyvirtualdisplay")
    print(result)
    print("pyvirtualdisplay installed")
コード例 #5
0
def setup_firefox():
    print("Installing Firefox.")
    with cd("~"):
        result = run("sudo apt-get -y install firefox")
    with cd("~"):
        result = run("firefox -v")
    assert("Firefox" in result)
    print(result)
    print("Firefox installed")
コード例 #6
0
 def test_005_app_installed(self):
     "Test that the application directory and software are present"
     with cd("~/workspace"):
         result = run("ls -l")
     self.assertTrue("application" in result)
     with cd("~/workspace/application"):
         result = run("ls -l")
     self.assertTrue("manage.py" in result)
     self.assertTrue("lists" in result)
コード例 #7
0
def setup_django():
    print("Installing Django.")
    with cd("~"):
        result = run("sudo pip3 install django")
    with cd("~"):
        result = run("pip3 list | grep Django")
    print(result)
    print("Django installed")
    assert(result.startswith("Django"))
コード例 #8
0
def setup_git():
    print("Installing git.")
    with cd("~"):
        result = run("sudo apt-get -y install git")
    with cd("~"):
        result = run("git --version")
    print(result)
    print("git is installed")
    assert(result.startswith("git"))
コード例 #9
0
def setup_pip3():
    print("Installing pip3.")
    with cd("~"):
        result = run("sudo apt-get -y install python3-pip")
    with cd("~"):
        result = run("pip3 --version")
    print(result)
    print("pip3 is installed")
    assert(result.startswith("pip"))
コード例 #10
0
def setup_application():
    print("Installing application")
    with cd("~/wendy_workspace"):
        run("wget https://github.com/hjwp/book-example/archive/chapter_07.zip")
        result = run("sudo apt-get -y install unzip")
        run("unzip chapter_07.zip")
        run("mv book-example-chapter_07 application")
    with cd("~/wendy_workspace/application"):
        run("python3 manage.py migrate")
    print("Application installed")
コード例 #11
0
 def test_003_directory_pemission(self):
     with cd("~/sites"):
         result = run("ls -l")
         results = result.split("\n")
         for result in results:
             if "todo.gdelo.com" in result:
                 self.assertTrue("drwxrwxr-x" in result)
コード例 #12
0
def setup_selenium():
    print("Installing Selenium.")
    with cd("~"):
        result = run("sudo pip3 install selenium")
    #with cd("~"):
        #result = run("pip3 list | grep Django")
    print(result)
    print("Selenium installed")
コード例 #13
0
def start_application():
    with cd("~/workspace/application"):
        #run(setup + "nohup python3 manage.py runserver 0.0.0.0:3000 &")
        #run(setup + "nohup ps -aux \&")
        pass
コード例 #14
0
def start_application():
    with cd("~/wendy_workspace/application"):
        result = run("python3 manage.py runserver 127.0.0.1:8000")
        print(result)
        #run(setup + "nohup ps -aux \&")
        pass
コード例 #15
0
 def test_004_django(self):
     "Django is installed."
     with cd("~"):
         result = run(setup + "pip3 list | grep Django")
     self.assertTrue(result.startswith("Django"))
コード例 #16
0
 def test_003_git(self):
     "git is installed."
     with cd("~"):
         result = run(setup + "git --version")
     self.assertTrue(result.startswith("git"))
コード例 #17
0
 def test_002_pip3(self):
     "Pip3 is installed."
     with cd("~"):
         result = run(setup + "pip3 --version")
     self.assertTrue(result.startswith("pip"))
コード例 #18
0
 def test_001_python3(self):
     "Python 3 is installed."
     with cd("~"):
         result = run(setup + "python3 --version")
     self.assertTrue("Python 3" in result)
コード例 #19
0
from remote_api import env,cd,run
from private import user, password

env.host_string = 'ssh.pythonanywhere.com'
env.user = user
env.password = password

with cd(""):
    print(run("ls -l | grep READ"))
コード例 #20
0
def setup_django():
    with cd("~"):
        result = run(setup + "pip3 install django")
    with cd("~"):
        result = run(setup + "pip3 list | grep Django")
    assert(result.startswith("Django"))
コード例 #21
0
 def test_007_django(self):
     "Firefox is installed."
     with cd("~"):
         result = run("firefox -v")
     self.assertTrue("Firefox" in result)
コード例 #22
0
 def test_006_app_is_running(self):
     "Test that a Django application is running"
     with cd("~"):
         result = run("ps -aux | grep python")
     self.assertTrue("manage.py" in result)
コード例 #23
0
from remote_api import env, cd, run
from private import user, password

env.host_string = "localhost"
env.user = "******"
env.password = ""

with cd("~/workspace"):
    print(run("ls -l"))
コード例 #24
0
 def test_000_login(self):
     "Server is present and we can log in."
     with cd("~/workspace"):
         result = run("whoami")
     self.assertTrue(env.user in result)