[gnome-boxes/wip/automated-tests: 18/29] tests: Remove ugly 'u' prefix from strings
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/wip/automated-tests: 18/29] tests: Remove ugly 'u' prefix from strings
- Date: Sat, 31 Jan 2015 10:43:40 +0000 (UTC)
commit 4315e261a1800f85bf441370b72479b9f0d76797
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Fri Jan 9 01:02:47 2015 +0000
tests: Remove ugly 'u' prefix from strings
tests/steps/creation.py | 13 ++++++-----
tests/steps/general.py | 43 +++++++++++++++++++++--------------------
tests/steps/multi-window.py | 5 ++-
tests/steps/snapshot.py | 21 ++++++++++---------
tests/steps/system-broker.py | 5 ++-
tests/steps/utils.py | 19 +++++++++--------
6 files changed, 56 insertions(+), 50 deletions(-)
---
diff --git a/tests/steps/creation.py b/tests/steps/creation.py
index 5cde6c7..a6e59ab 100644
--- a/tests/steps/creation.py
+++ b/tests/steps/creation.py
@@ -1,11 +1,12 @@
# -*- coding: UTF-8 -*-
+from __future__ import unicode_literals
from behave import step
from dogtail.rawinput import typeText
from time import sleep
from utils import get_showing_node_name
- step(u'Create new box "{name}"')
+ step('Create new box "{name}"')
def create_machine(context, name):
"""
Create new box, wait till it finish and save IP
@@ -19,7 +20,7 @@ def create_machine(context, name):
* Press "back" in vm
""" %(name, name))
- step(u'Create new box from file "{location}"')
+ step('Create new box from file "{location}"')
def create_new_vm_via_file(context, location):
path = location.split('/')
context.app.child('New').click()
@@ -31,7 +32,7 @@ def create_new_vm_via_file(context, location):
selector.child(item).click()
selector.child('Open').click()
- step(u'Create new box from url "{url}"')
+ step('Create new box from url "{url}"')
def create_new_vm_via_url(context, url):
context.app.child('New').click()
context.app.child('Continue').click()
@@ -51,13 +52,13 @@ def create_new_vm_via_url(context, url):
else:
sleep(30)
- step(u'Create new box from menu "{sys_name}"')
+ step('Create new box from menu "{sys_name}"')
def create_new_vm_from_menu(context, sys_name):
context.app.child('New').click()
context.app.child('Continue').click()
get_showing_node_name(sys_name, context.app).click()
- step(u'Import machine "{name}" from image "{location}"')
+ step('Import machine "{name}" from image "{location}"')
def import_image(context, name, location):
context.execute_steps(u"""
* Create new box from file "%s"
@@ -65,7 +66,7 @@ def import_image(context, name, location):
* Save IP for machine "%s"
""" %(location, name))
- step(u'Initiate new box "{name}" installation')
+ step('Initiate new box "{name}" installation')
def create_machine_no_wait(context, name):
"""
Initiate new box installation, no IP saved, no wait for box readines
diff --git a/tests/steps/general.py b/tests/steps/general.py
index d7727a0..10aec0d 100644
--- a/tests/steps/general.py
+++ b/tests/steps/general.py
@@ -1,5 +1,6 @@
# -*- coding: UTF-8 -*-
+from __future__ import unicode_literals
from behave import step
from dogtail.tree import root
from dogtail.rawinput import typeText, pressKey, keyCombo
@@ -7,11 +8,11 @@ from time import sleep
from common_steps import wait_until
from subprocess import call, check_output, Popen, CalledProcessError
- step(u'About is shown')
+ step('About is shown')
def about_shown(context):
assert context.app.child('About Boxes') != None, "About window cannot be focused"
- step(u'Box "{name}" "{state}" exist')
+ step('Box "{name}" "{state}" exist')
def does_box_exists(context, name, state):
found = False
pane = context.app.child(roleName='layered pane')
@@ -25,17 +26,17 @@ def does_box_exists(context, name, state):
if state == 'does not':
assert found == False, "Machine %s was found in overview" % name
- step(u'Boxes are not running')
+ step('Boxes are not running')
def boxes_not_running(context):
assert context.app_class.isRunning() != True, "Boxes window still visible"
- step(u'Boxes app has "{num}" windows')
+ step('Boxes app has "{num}" windows')
def number_of_windows(context, num):
assert len(context.app.children) == int(num), "App has just %s windows not %s"
%(len(context.app.children), num)
- step(u'Customize mem to 64 MB')
+ step('Customize mem to 64 MB')
def customize_vm(context):
- context.app.child(u'Customize…').click()
+ context.app.child('Customize…').click()
sleep(0.5)
pressKey('Tab')
pressKey('Tab')
@@ -45,7 +46,7 @@ def customize_vm(context):
context.app.children[0].children[0].children[3].child('Back').click()
sleep(0.5)
- step(u'Delete all boxes')
+ step('Delete all boxes')
def delete_all(context):
context.app.findChildren(lambda x: x.name == 'New')[0].grabFocus()
pane = context.app.child(roleName='layered pane')
@@ -58,7 +59,7 @@ def delete_all(context):
pressKey('Enter')
sleep(4)
- step(u'Go into "{vm}" box')
+ step('Go into "{vm}" box')
def go_into_vm(context, vm):
pane = context.app.child(roleName='layered pane')
for child in pane.children:
@@ -67,17 +68,17 @@ def go_into_vm(context, vm):
sleep(0.5)
break
- step(u'Help is shown')
+ step('Help is shown')
def help_shown(context):
sleep(1)
yelp = root.application('yelp')
assert yelp.child('Boxes') != None, "Yelp wasn't opened"
- step(u'No box is visible')
+ step('No box is visible')
def no_box_sign(context):
assert context.app.child('No boxes found') != None
- step(u'Press "{action}" in vm')
+ step('Press "{action}" in vm')
def press_back_in_vm(context, action):
panel = context.app.child('Boxes').children[0].findChildren(lambda x: x.roleName == 'panel' and
x.showing)[0]
buttons = panel.findChildren(lambda x: x.roleName == 'push button' and x.showing)
@@ -87,18 +88,18 @@ def press_back_in_vm(context, action):
buttons[1].click()
sleep(0.5)
- step(u'Press "{action}" in alert')
+ step('Press "{action}" in alert')
def press_back_in_prefs(context, action):
button = context.app.child(roleName='alert').child(action)
button.click()
sleep(0.5)
- step(u'Quit Boxes')
+ step('Quit Boxes')
def quit_boxes(context):
keyCombo('<Ctrl><Q>')
sleep(5)
- step(u'Rename "{machine}" to "{name}" via "{way}"')
+ step('Rename "{machine}" to "{name}" via "{way}"')
def rename_vm(context, machine, name, way):
if way == 'button':
context.app.child(machine, roleName='push button').click()
@@ -109,7 +110,7 @@ def rename_vm(context, machine, name, way):
pressKey('Enter')
sleep(0.5)
- step(u'Save IP for machine "{vm}"')
+ step('Save IP for machine "{vm}"')
def save_ip_for_vm(context, vm):
if not hasattr(context, 'ips'):
context.ips = {}
@@ -143,7 +144,7 @@ def save_ip_for_vm(context, vm):
context.ips[vm] = ip
- step(u'Select "{vm}" box')
+ step('Select "{vm}" box')
def select_vm(context, vm):
pane = context.app.child(roleName='layered pane')
for child in pane.children:
@@ -152,7 +153,7 @@ def select_vm(context, vm):
sleep(0.2)
break
- step(u'Select "{action}" from supermenu')
+ step('Select "{action}" from supermenu')
def select_menu_action(context, action):
keyCombo("<Super_L><F10>")
if action == 'About':
@@ -162,21 +163,21 @@ def select_menu_action(context, action):
pressKey('Down')
pressKey('Enter')
- step(u'Start Boxes')
+ step('Start Boxes')
def start_boxes(context):
cmd = 'gnome-boxes'
Popen(cmd, shell=True)
sleep(1)
context.app = root.application('gnome-boxes')
- step(u'Start box name "{box}"')
+ step('Start box name "{box}"')
def start_boxes_via_vm(context, box):
cmd = 'gnome-boxes %s' %box
Popen(cmd, shell=True)
sleep(5)
context.app = root.application('gnome-boxes')
- step(u'Verify back button "{state}" visible for machine "{vm_name}"')
+ step('Verify back button "{state}" visible for machine "{vm_name}"')
def verify_back_button_visibility(context, state, vm_name):
if state == "is":
main = context.app.children[0]
@@ -188,7 +189,7 @@ def verify_back_button_visibility(context, state, vm_name):
back_button = main_window_panel.child(roleName='push button')
assert back_button.showing == False, "Back button is visible but it shouldn't be"
- step(u'Wait until overview is loaded')
+ step('Wait until overview is loaded')
def initial_page_loaded(context):
wait_until(lambda x: x.name != 'New', context.app)
context.execute_steps(u"""
diff --git a/tests/steps/multi-window.py b/tests/steps/multi-window.py
index e35252f..3a6d7b7 100644
--- a/tests/steps/multi-window.py
+++ b/tests/steps/multi-window.py
@@ -1,12 +1,13 @@
# -*- coding: UTF-8 -*-
+from __future__ import unicode_literals
from behave import step
from dogtail.rawinput import pressKey
from dogtail import predicate
from time import sleep
from utils import get_showing_node_rolename, get_showing_node_name
- step(u'Focus "{window}" window')
+ step('Focus "{window}" window')
def focus_window(context, window):
if window == 'main':
context.app.findChildren(lambda x: x.name == 'New' and x.showing and x.sensitive)[0].grabFocus()
@@ -21,7 +22,7 @@ def focus_window(context, window):
pressKey('Tab')
sleep(0.5)
- step(u'Open "{vm_names_list}" in new windows')
+ step('Open "{vm_names_list}" in new windows')
def open_new_windows(context, vm_names_list):
vm_names = vm_names_list.split(',')
names = []
diff --git a/tests/steps/snapshot.py b/tests/steps/snapshot.py
index 363130b..81aa122 100644
--- a/tests/steps/snapshot.py
+++ b/tests/steps/snapshot.py
@@ -1,11 +1,12 @@
# -*- coding: UTF-8 -*-
+from __future__ import unicode_literals
from behave import step
from dogtail.rawinput import typeText, pressKey
from time import sleep
from utils import get_showing_node_name
- step(u'Add Snapshot named "{name}"')
+ step('Add Snapshot named "{name}"')
def add_snapshot(context, name):
wait = 0
while len(context.app.findChildren(lambda x: x.roleName == 'push button' and x.showing and not x.name))
== 0:
@@ -18,7 +19,7 @@ def add_snapshot(context, name):
wait = 0
while len(context.app.findChildren(lambda x: x.roleName == 'toggle button' and x.showing \
- and x.sensitive and x.name ==
'Menu')) == 0:
+ and x.sensitive and x.name ==
'Men')) == 0:
sleep(1)
wait += 1
if wait == 5:
@@ -26,19 +27,19 @@ def add_snapshot(context, name):
sleep(1)
context.app.findChildren(lambda x: x.roleName == 'toggle button' and x.showing \
- and x.sensitive and x.name ==
'Menu')[-1].click()
+ and x.sensitive and x.name ==
'Men')[-1].click()
renames = context.app.findChildren(lambda x: x.name == 'Rename' and x.showing)
if not renames:
context.app.findChildren(lambda x: x.roleName == 'toggle button' and x.showing and x.sensitive \
- and x.name ==
'Menu')[-1].click()
+ and x.name ==
'Men')[-1].click()
renames = context.app.findChildren(lambda x: x.name == 'Rename' and x.showing)
renames[0].click()
sleep(0.5)
typeText(name)
context.app.findChildren(lambda x: x.showing and x.name == 'Done')[0].click()
- step(u'Create snapshot "{snap_name}" from machine "{vm_name}"')
+ step('Create snapshot "{snap_name}" from machine "{vm_name}"')
def create_snapshot(context, snap_name, vm_name):
context.execute_steps(u"""
* Select "%s" box
@@ -48,7 +49,7 @@ def create_snapshot(context, snap_name, vm_name):
* Press "Back"
""" %(vm_name, snap_name))
- step(u'Delete machines "{vm_name}" snapshot "{snap_name}"')
+ step('Delete machines "{vm_name}" snapshot "{snap_name}"')
def delete_snapshot(context, vm_name, snap_name):
context.execute_steps(u"""
* Select "%s" box
@@ -57,7 +58,7 @@ def delete_snapshot(context, vm_name, snap_name):
""" % vm_name)
name = context.app.findChildren(lambda x: x.name == snap_name and x.showing)[0]
- name.parent.child('Menu').click()
+ name.parent.child('Men').click()
delete = context.app.findChildren(lambda x: x.name == "Delete" and x.showing)[0]
delete.click()
@@ -69,7 +70,7 @@ def delete_snapshot(context, vm_name, snap_name):
get_showing_node_name('Back', context.app).click()
sleep(0.5)
- step(u'Revert machine "{vm_name}" to state "{snap_name}"')
+ step('Revert machine "{vm_name}" to state "{snap_name}"')
def revert_snapshot(context, vm_name, snap_name):
context.execute_steps(u"""
* Select "%s" box
@@ -78,9 +79,9 @@ def revert_snapshot(context, vm_name, snap_name):
""" % vm_name)
name = context.app.findChildren(lambda x: x.name == snap_name and x.showing)[0]
- name.parent.child('Menu').click()
+ name.parent.child('Men').click()
revert = context.app.findChildren(lambda x: x.name == "Revert to this state" and x.showing)[0]
revert.click()
get_showing_node_name('Back', context.app).click()
- sleep(0.5)
\ No newline at end of file
+ sleep(0.5)
diff --git a/tests/steps/system-broker.py b/tests/steps/system-broker.py
index f32625a..54027d1 100644
--- a/tests/steps/system-broker.py
+++ b/tests/steps/system-broker.py
@@ -1,8 +1,9 @@
# -*- coding: UTF-8 -*-
+from __future__ import unicode_literals
from behave import step
- step(u'Connect to system broker')
+ step('Connect to system broker')
def connect_to_filled_system_broker(context):
context.execute_steps(u"""
* Wait for "virt-install -q -r 128 --name Core-5.3 --nodisks --cdrom /tmp/Core-5.3.iso --os-type
linux --accelerate --connect qemu:///system --wait 0" end
@@ -13,7 +14,7 @@ def connect_to_filled_system_broker(context):
* Save IP for machine "Core-5.3"
""")
- step(u'Connect to empty system broker')
+ step('Connect to empty system broker')
def connect_to_empty_system_broker(context):
context.execute_steps(u"""
* Create new box from url "qemu:///system"
diff --git a/tests/steps/utils.py b/tests/steps/utils.py
index 3327386..e622c10 100644
--- a/tests/steps/utils.py
+++ b/tests/steps/utils.py
@@ -1,5 +1,6 @@
# -*- coding: UTF-8 -*-
+from __future__ import unicode_literals
from behave import step
from dogtail.rawinput import typeText, pressKey, keyCombo
from time import sleep
@@ -25,19 +26,19 @@ def get_showing_node_rolename(rolename, parent, timeout=30, step=0.25):
return parent.findChildren(lambda x: x.roleName == rolename and x.showing and x.sensitive)[0]
- step(u'Cannot ping "{vm}"')
+ step('Cannot ping "{vm}"')
def cannot_ping_vm(context, vm):
cmd = "ping -qn -c 1 %s" %context.ips[vm]
assert call(cmd, shell=True) != 0, "Machine %s is pingable!" %vm
- step(u'Close warning')
+ step('Close warning')
def close_warning(context):
context.app.findChildren(lambda x: x.name == 'Undo' and x.showing)[0].grabFocus()
pressKey('Tab')
pressKey('Enter')
sleep(1)
- step(u'Hit "{keycombo}"')
+ step('Hit "{keycombo}"')
def hit_keycombo(context, keycombo):
sleep(0.2)
if keycombo == "Enter":
@@ -47,7 +48,7 @@ def hit_keycombo(context, keycombo):
sleep(0.2)
- step(u'"{pattern}" is visible with command "{command}"')
+ step('"{pattern}" is visible with command "{command}"')
def check_pattern_visible(context, pattern, command):
sleep(0.2) # time for all to get set
try:
@@ -56,27 +57,27 @@ def check_pattern_visible(context, pattern, command):
out = e.output
assert out.find(pattern) != -1, 'pattern %s is not visible with %s' % (pattern, command)
- step(u'"{pattern}" is not visible with command "{command}"')
+ step('"{pattern}" is not visible with command "{command}"')
def check_pattern_not_visible(context, pattern, command):
sleep(0.2) # time for all to get set
out = check_output(command, shell=True)
assert out.find(pattern) == -1, 'pattern %s is visible with %s' % (pattern, command)
- step(u'Ping "{vm}"')
+ step('Ping "{vm}"')
def ping_vm(context, vm):
cmd = "ping -qn -c 2 %s > /dev/null 2>&1" %context.ips[vm]
assert call(cmd, shell=True) == 0, "Machine %s is not pingable" %vm
- step(u'Press "{button}"')
+ step('Press "{button}"')
def press_button(context, button):
get_showing_node_name(button, context.app).click()
sleep(0.5)
- step(u'Type "{text}"')
+ step('Type "{text}"')
def type_text(context, text):
typeText(text)
pressKey('Enter')
- step(u'Wait for "{cmd}" end')
+ step('Wait for "{cmd}" end')
def wait_for_cmd(context, cmd):
call(cmd, shell=True)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]