Skip to content
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

th/clients-tests #130

Closed
wants to merge 10 commits into from
Closed

th/clients-tests #130

wants to merge 10 commits into from

Conversation

thom311
Copy link
Member

@thom311 thom311 commented Jun 5, 2018

Extend unit tests to verify connection using libnm.

This war rather cumbersome to do, because our test-networkmanager-service.py uses python's D-Bus library, while libnm uses GDBus. Hence, I first had to convert the dbus structure to a GVariant, which is surprisingly complicated.

@bengal
Copy link
Contributor

bengal commented Jun 5, 2018

LGTM

- don't use "hash" for a local variable in python.
  The editor highlights it like a special python name.

- don't use "settings" for Connection.settings. Name it
  Connection.con_hash. The name "settings" is over-used already.
  "con_hash" really is the nested dictionary that we expose/receive
  from D-Bus. If we would use libnm for it, it would be an
  NMSimpleConnection instance, but we don't.
lso, the name "connection" and "con" is overused.

Use "con_inst" where we mean an instance of a "Connection" class,
that is, the object exposed on D-Bus.
These names are unique and well-known.
Define all custom exception types together.
…sing libnm

The real NetworkManager service has a clear understanding how a valid
connection looks like. This is what nm_connection_verify() returns.

Let also our stub-service verify connections the same way.

Note that this is cumbersome, because the stub service uses python's
dbus module, while libnm only accepts creating NMConnection instances
from GVariant. Thus, we need to a cumbersome conversion first.

It would be better if test-networkmanager-service.py would also expose
normalized connections on D-Bus. But that requires the inverse converion
from GVariant to python dbus.
Just to give it some variety. Also, note how the message from the
server cannot be translated. Which is the case with real NetworkManager
as well, and is a major usability issue.
@thom311
Copy link
Member Author

thom311 commented Jun 6, 2018

Merged to master

@thom311 thom311 closed this Jun 6, 2018
@thom311 thom311 deleted the th/clients-tests branch June 6, 2018 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants