4 Commits

Author SHA1 Message Date
Pawel Stolowski
4121d58bbb interfaces: fix decoding of json numbers for static/dynamic attributes
* ifstate: fix decoding of json numbers

When we read the static slots/plugs from the state we decode them
as with the default json decoding. This leads to float64 instead
of the expected int. This PR fixes it and adds tests.

It also adds support in NormalizeInterfaceAttributes for json.Number.
2018-10-22 20:36:27 -06:00
Zygmunt Krynicki
4144a1322e interfaces: fix NormalizeInterfaceAttributes, add tests (#6012)
* interfaces: fix NormalizeInterfaceAttributes, add tests

The NormalizeInterfaceAttributes was untested so I fixed that. While
working on tests I noticed that it was unexpectedly mutating the
argument it was given (while returning a return value) so I fixed and
tested that as well.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

* interfaces: test normalization of float32

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

* interfaces: add tests for CopyAttributes

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2018-10-18 09:17:02 +02:00
Zygmunt Krynicki
d77035bdf2 snap,interfaces: move interface name validation to snap
This patch moves the helper that validates plug, slot and interface
names to the snap package (alongside other validation helpers).

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2018-07-02 23:15:51 +02:00
Pawel Stolowski
f0d383851c Move tests as well. 2018-06-28 18:14:30 +02:00