Commit graph

14 commits

Author SHA1 Message Date
Thomas Haller c569fc23bf libnm/tests: fix handling ByteArray in test-networkmanager-service.py for Python 3
In Python 3, dbus.ByteArray() must be created using a byte string,
while strings obtained via DBUS are unicode strings.

This was wrong in WifiAp.__get_props() which broke the test
test_wifi_ap_added_removed().

    File "/usr/lib/python3.3/site-packages/dbus/service.py", line 707, in _message_cb
      retval = candidate_method(self, *args, **keywords)
    File "./NetworkManager/tools/test-networkmanager-service.py", line 102, in GetAll
      return self._get_dbus_properties(iface)
    File "./NetworkManager/tools/test-networkmanager-service.py", line 96, in _get_dbus_properties
      return self.__dbus_ifaces[iface]()
    File "./NetworkManager/tools/test-networkmanager-service.py", line 315, in __get_props
      props[PP_SSID] = dbus.ByteArray(self.ssid)
    TypeError: string argument without an encoding

https://bugzilla.gnome.org/show_bug.cgi?id=739448
2015-01-05 14:18:47 +01:00
Thomas Haller 0923769285 test,examples: fix scripts to avoid 'has_key' for Python 3
'has_key' on Dictionaries is removed from Python3 in favor of 'in'.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-31 16:39:00 +01:00
Dan Winship 3be53899fa libnm-core, settings: move NMSettingsError to nm-errors
Move the definition of NMSettingsError to nm-errors, register it with
D-Bus, and verify in the tests that it maps correctly.

Remove a few unused error codes, simplify a few others, and rename
GENERAL to FAILED and HOSTNAME_INVALID to INVALID_HOSTNAME, for
consistency.
2014-10-22 08:29:09 -04:00
Dan Winship 4f75ff92b4 libnm-core, libnm, devices: merge client and daemon NMDeviceError
Merge libnm's NMDeviceError and the daemon's NMDeviceError into a
single enum (in nm-errors.h). Register the domain with D-Bus, and add
a test that the client side decodes it correctly.

The daemon's NM_DEVICE_ERROR_CONNECTION_INVALID gets absorbed into
libnm's NM_DEVICE_ERROR_INVALID_CONNECTION, and
NM_DEVICE_ERROR_UNSUPPORTED_DEVICE_TYPE gets dropped, since it was
only returned from one place, which is now using
NM_DEVICE_ERROR_FAILED, since (a) it ought to be a "can't happen", and
(b) the only caller of that function just logs error->message and then
frees the error without ever looking at the code.
2014-10-22 08:29:08 -04:00
Dan Winship 9c67b6fb08 libnm-core, core: register NMConnectionError with D-Bus
Register NMConnectionError with D-Bus on both sides, so that, eg,
connection validation failures in the daemon will translate to the
correct error codes in the client.
2014-10-22 08:29:08 -04:00
Dan Winship be8060f42f libnm: add an object-creation-failed test 2014-10-19 09:27:48 -04:00
Dan Winship ba900f2a44 tools: add a bit of support for VLANs to test-networkmanager-service.py 2014-10-19 09:27:48 -04:00
Dan Winship b9c09a2b0d tools: add a bit more activation support to test-networkmanager-service.py
Now test-networkmanager-service.py can create ActiveConnections, though
they don't actually finish activating.
2014-10-19 09:27:47 -04:00
Dan Winship bc003f6273 tools: fix test-networkmanager-service Settings.Connections
The test settings service wasn't exporting a Connections property.
2014-09-18 11:51:07 -04:00
Dan Winship c9fb96e02e libnm: add test-secret-agent
Implement some basic secret agent functionality in
test-networkmanager-service.py, and add test-secret-agent to test that
NMSecretAgent works as expected.
2014-09-09 12:16:38 -04:00
Thomas Haller 2ac34e437f libnm-glib/test: fix test failure for test-remote-settings-client
Due to behavioral change of test-networkmanager-service.py, the test
/remote_settings/remove_connection fails (test_remove_connection() at
test-remote-settings-client.c:318).

Fixes: 66a3480329
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-08 11:39:44 +02:00
Dan Winship 66a3480329 libnm: add a test for connection-deleted-while-being-created
Since NMRemoteSettings doesn't announce new connections until it has
fetched their properties, it's possible that a connection could get
deleted while we're waiting for it to be created. NMRemoteSettings has
code to deal with this, so add a test to make sure that it works.
2014-08-07 15:43:43 -04:00
Dan Winship 08b91199fb libnm-glib: make test-networkmanager-service.py automatically exit with its parent
test-nm-client.c and test-remote-settings-client.c were using their
own assertion macros so they could kill the test service on assertion
failure. Except that some new code didn't get the memo and used the
g_assert* macros. Not to mention that sometimes the tests would crash
outside of an assertion macro.

We can make test-networkmanager-service.py notice that its parent has
crashed by opening a pipe between them and taking advantage of the
fact that the pipe will be automatically closed if the parent crashes.
So then test-networkmanager-service.py just has to watch for that, and
exit if the pipe closes.

Then that lets us drop the test_assert* macros and just use g_assert*
instead.
2014-08-01 12:12:42 -04:00
Dan Winship 5432ef5e52 tools: move libnm-glib's fake NM service implementations here
Move libnm-glib's test-fake-nm.py and test-remote-settings-service.py
to tools/, merge them together into a single program, and fix a few
bugs (notably some missing signal emissions in the Settings service).

Although they are currently only used by libnm-glib's tests, they are
generic enough that they could be used by other code in the future
(and in particular, they will be used by libnm's tests as well).
2014-07-30 15:56:29 -04:00
Renamed from libnm-glib/tests/test-fake-nm.py (Browse further)