Exemplo n.º 1
0
def test_list_no_image():

    cmd = f"list"

    result = common.cli(cmd)

    assert "No images built with dugaire found." == result
Exemplo n.º 2
0
def test_help():

    cmd = ""
    cmd += "--help"

    result = common.cli(cmd)

    assert f"Usage: cli [OPTIONS] COMMAND [ARGS]" in result
Exemplo n.º 3
0
def test_list_short():

    cmd = f"list --short"

    result = common.cli(cmd)

    assert "Image ID:" in result
    assert "Image tags:" in result
Exemplo n.º 4
0
def test_build_output_dockerfile():
    global _BUILT_IMAGES

    cmd = ""
    cmd += "build --output=dockerfile --dry-run"

    result = common.cli(cmd)

    assert "LABEL builtwith" in result
Exemplo n.º 5
0
def test_remove_all():
    global _BUILT_IMAGES

    cmd = ""
    cmd += f"remove --image=all"

    result = common.cli(cmd)

    assert "Images removed." == result
Exemplo n.º 6
0
def test_remove_image():
    global _BUILT_IMAGES

    cmd = ""
    cmd += f"remove --image={_BUILT_IMAGES[0]}"

    result = common.cli(cmd)

    assert "Image removed." == result
Exemplo n.º 7
0
def test_from_ubuntu_20_04_pkg_latest():
    cmd = f"build --from=ubuntu:20.04 --with-kubectl=latest"
    image_id = common.cli(cmd)
    assert len(image_id) == 12

    docker_run_output = common.docker_run(
        image_id, "kubectl version --client=true --output=json")
    docker_run_output = json.loads(docker_run_output)

    assert "gitVersion" in docker_run_output["clientVersion"]
Exemplo n.º 8
0
def test_build_output_image_name():
    global _BUILT_IMAGES

    cmd = ""
    cmd += "build --output=image.name"

    result = common.cli(cmd)

    assert 21 == len(result)

    _BUILT_IMAGES.append(result)
Exemplo n.º 9
0
def test_version():

    cmd = ""
    cmd += "--version"

    result = common.cli(cmd)

    info_version = info.get_version()
    info_prog_name = info.get_prog_name()

    assert f"{info_prog_name}, version {info_version}" == result
Exemplo n.º 10
0
def test_from_ubuntu_20_04_pkg_1_15_0():
    pkg_version = "1.15.0"
    cmd = f"build --from=ubuntu:18.04 --with-kubectl={pkg_version}"
    image_id = common.cli(cmd)
    assert len(image_id) == 12

    docker_run_output = common.docker_run(
        image_id, "kubectl version --client=true --output=json")
    docker_run_output = json.loads(docker_run_output)

    f"v{pkg_version}" == docker_run_output["clientVersion"]["gitVersion"]
Exemplo n.º 11
0
def test_build_default():
    global _BUILT_IMAGES

    cmd = ""
    cmd += "build"

    result = common.cli(cmd)

    assert 12 == len(result)

    _BUILT_IMAGES.append(result)
Exemplo n.º 12
0
def test_from_ubuntu20_04_pkg_latest():

    from_ = "ubuntu:20.04"
    pkg_version = "latest"
    pkg_version_assert = None

    cmd = f"build --from={from_} --with-azurecli={pkg_version}"
    image_id = common.cli(cmd)
    assert len(image_id) == 12

    docker_run_output = common.docker_run(image_id, "az version --output=json")

    assert "azure-cli" in docker_run_output
Exemplo n.º 13
0
def test_from_ubuntu20_04_pkg_2_14_2():

    from_ = "ubuntu:20.04"
    pkg_version = "2.14.2"

    cmd = f'build --from={from_} --apt=python3-pip --pip3="azure-cli=={pkg_version}"'

    image_id = common.cli(cmd)
    assert len(image_id) == 12

    docker_run_output = common.docker_run(image_id, "az version --output=json")
    docker_run_output = json.loads(docker_run_output)

    assert pkg_version == docker_run_output["azure-cli"]
Exemplo n.º 14
0
def newChar(prompt):
  name = com.cli(prompt["name"])
  char = CS(" ".join(name))
  print "Your name is", char.Name, '\n'

  job  = com.cli(prompt["job"])
  if '1' in job:
    char.assignClass("Warrior")
  elif '2' in job:
    char.assignClass("Mage")
  elif '3' in job:
    char.assignClass("Rogue")
  else:
    print "Learn to read."
    char.assignClass("Villager")

  print "Your profession is", char.job

  #char.assignSkills()

  print "Allocate your stat points"
  char.allocPts(pts_new)

  enterDungeon(char, prompt)
Exemplo n.º 15
0
  def allocPts(self, free_pts):  #this is gross, need to clean up
    inc = 0
    while free_pts > 0:
      print "You have", free_pts, "points to spend"
      for i, stat in enumerate(dict.iteritems(self.S)):
        print str(i+1)+'.', stat[0], '=', stat[1]
      inc = com.cli()
      for i, stat in enumerate(dict.iteritems(self.S)):
        if any(word in str(i+1)+'. '+ stat[0] for word in inc):
          self.S[stat[0]] += 1
          free_pts -= 1

    print "Current stats are:"
    for stat in dict.iteritems(self.S):
      print stat[0], '=', stat[1]
    print self.HP['max'], self.MP['max']
Exemplo n.º 16
0
    def __init__(self, master=None, args=cli()):
        super().__init__(master)
        self.master = master
        self.args = args

        self.keypoint_sets = None
        self.keypoint_ovals = None
        self._job = None
        self.cap = None
        self.scoreLabel = None

        self.master.bind("<Escape>", self.terminate)
        self.init_processor()

        self.poseThread = PoseThread(self)
        self.poseThread.start()
Exemplo n.º 17
0
def test_from_ubuntu_20_04_pkg_version():
    kubectl_version = "1.17.0"
    velero_version = "1.5.2"
    cmd = f"build --from=ubuntu:20.04 --with-kubectl={kubectl_version} --with-velero={velero_version}"
    image_id = common.cli(cmd)
    assert len(image_id) == 12

    docker_run_output = common.docker_run(
        image_id, "kubectl version --client=true --output=json"
    )
    docker_run_output = json.loads(docker_run_output)

    f"v{kubectl_version}" == docker_run_output["clientVersion"]["gitVersion"]

    docker_run_output = common.docker_run(image_id, "velero version --client-only")

    assert f"Version: v{velero_version}" in docker_run_output
Exemplo n.º 18
0
def battleMode(pc):
  print 'this is battle!!!!!'

  #test gen an enemy - one at a time
  mon = random.choice(monster["monsters"].items())
  enemy = CS(mon[0], mon[1])
  print 'You are fighting a', enemy.Name
  initiative = random.randint(0,9) % 2

  player_hp = pc.HP['curr']
  mon_hp = enemy.HP['curr']

  while player_hp > 0 and mon_hp > 0:

    if initiative == 0:  # your turn
      action = com.cli(battle_menu)
      if 'attack' in action:
        dmg = pc.S['STR']
        mon_hp -= dmg
        print "You dealt", dmg, 'damage'
      elif 'skills' in action:
        print 'need to implement skillz! you just wasted a turn'
      elif 'items' in action:
        print 'need to implement items!'
      elif 'flee' in action:
        print 'You bravely ran away!'
        return

    else:  #enemy turn
      action = ai.ai_mook()
      if 'attack' in action:
        dmg = enemy.S['STR']
        player_hp -= dmg
        print enemy.Name, "has dealt", dmg, "damage to you"

    initiative = (initiative + 1) % 2

  if not player_hp > 0:
    print "You have died!"
    # do dead things
  else:
    print "You have defeated the", enemy.Name
    pc.expUp(enemy.LVL * 10)
Exemplo n.º 19
0
def enterDungeon(pc, prompt):
  #load rng dungeon
  #dungeon = createDungeon()

  #run dungeon
  while True:
    action = " ".join(com.cli("How will you proceed?"))
    #dungeon.validate(action)  #what do? check against dungeon state
    #  need to place pc at start of dungeon
    #if dungeon goal is achieved, end quest/break loop

    ###test lines to implement lvlup, battle sys
    if 'lvlup' in action:
      pc.lvlUp()

    if 'battle' in action:
      battleMode(pc)

    if 'exit' in action:
      break
Exemplo n.º 20
0
import tkinter as tk

from common import cli
from gui_app import Application
from gui_component import HoverButton, Modal
from exercise import EXERCISE

######## Init ########
root = tk.Tk()
root.title("Office Pose")
root.geometry("1400x650")

container = tk.Frame(root)
container.pack(side="top", fill="both", expand=True)

app = Application(master=root, args=cli())
app.place(in_=container, x=0, y=0, relwidth=1, relheight=1)

mainPage = tk.Frame(root)
mainPage.place(in_=container, x=0, y=0, relwidth=1, relheight=1)


######## Function ########
def onStart():
    app.start(list(EXERCISE.keys()))
    app.lift()


def onBack():
    app.pause()
    mainPage.lift()
Exemplo n.º 21
0
def test_from_ubuntu_20_04_no_kubectl():
    cmd = f"build --from=ubuntu:20.04 --with-velero=1.5.2"
    result = common.cli(cmd)
    assert "Bad usage --with-velero requires --with-kubectl" in result
Exemplo n.º 22
0
def test_from_ubuntu_20_04_bad_usage():
    invalid_option = "THIS.IS.INVALID"
    cmd = f"build --from=ubuntu:20.04 --with-velero={invalid_option}"
    result = common.cli(cmd)
    assert f"Bad usage --with-velero={invalid_option}" in result