-
Notifications
You must be signed in to change notification settings - Fork 32
test: fixes to call-forwarding scripts #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,14 +5,17 @@ from gi.repository import GLib | |
| import argparse | ||
| import dbus | ||
| import dbus.mainloop.glib | ||
| import sys | ||
|
|
||
| def property_changed(property, value): | ||
| print("CallForwarding property %s changed to %s" % (property, value)) | ||
|
|
||
| def print_properties(cf): | ||
| properties = cf.GetProperties() | ||
|
|
||
| for p in properties: | ||
| for p in ["VoiceBusy", "VoiceNoReplyTimeout", "VoiceNotReachable", | ||
| "VoiceUnconditional", "VoiceNoReply", | ||
| "ForwardingFlagOnSim"]: | ||
| if len(properties[p].__str__()) > 0: | ||
| print("%s call forwarding rule is: %s" % (p, properties[p])) | ||
| else: | ||
|
|
@@ -42,6 +45,16 @@ def parse_arguments(): | |
| help="""Specify an unconditional forwarding number""", | ||
| default="+155555", | ||
| ) | ||
| parser.add_argument("--unreach-num", | ||
| dest="unreach_num", | ||
| help="""Specify an un-reachable forwarding number""", | ||
| default="+155555", | ||
| ) | ||
| parser.add_argument("--busy-num", | ||
| dest="busy_num", | ||
| help="""Specify a busy forwarding number""", | ||
| default="+155555", | ||
| ) | ||
| parser.add_argument("--noreply-timeout", | ||
| dest="noreply_timeout", | ||
| help="""Specify a no-reply timeout""", | ||
|
|
@@ -140,9 +153,21 @@ def main(args): | |
| except dbus.DBusException as e: | ||
| print("Unable to set Voice Unconditional - Bad") | ||
|
|
||
| try: | ||
| cf.SetProperty("VoiceBusy", args.busy_num) | ||
| except dbus.DBusException as e: | ||
| print("Unable to set Voice Busy - Bad") | ||
|
|
||
| try: | ||
| cf.SetProperty("VoiceNotReachable", args.unreach_num) | ||
| except dbus.DBusException as e: | ||
| print("Unable to set Voice Not Reachable - Bad") | ||
|
|
||
| properties = cf.GetProperties() | ||
|
|
||
| print(properties["VoiceUnconditional"]) | ||
| print(properties["VoiceBusy"]) | ||
| print(properties["VoiceNotReachable"]) | ||
|
|
||
| try: | ||
| cf.DisableAll("foobar") | ||
|
|
@@ -171,4 +196,8 @@ def main(args): | |
|
|
||
| if __name__ == "__main__": | ||
| args = parse_arguments() | ||
| main(args) | ||
|
|
||
| try: | ||
| main(args) | ||
| except KeyboardInterrupt as e: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handling the interrupt is nice, but I think that adding some timeout (~30 secs) to exit the script would be good to have too.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, if you think that's warranted, I can add...
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think making sure it exits would remove the feeling that something went wrong when executing the script. An alternative could be to print something like "Waiting for property changes, press Ctrl+C when finished" if you prefer that. |
||
| sys.exit(0) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you do this change? The set you use between the brackets is exactly the same contained in "properties".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this so that I could get rid of the first test case in:
https://wiki.ubuntu.com/Process/Merges/TestPlans/ofono/CallForwarding
This change now causes the script to verify that the interface and all the properties are properly exported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, but taking into account that that is Ubuntu Touch's test plan, I am not sure if upstream would accept this change if that is the only reason. If we want to fully automatize CallForwarding testing I think we should create a different script similar to the ones you created for testing the SIM interface, because I do not think that test-call-forwarding fully fits our testing needs.