12 Commits

Author SHA1 Message Date
Michael Vogt
d6708bd7e1 daemon,usersession: switch from HeaderMap to Header in tests
The `rec.HeaderMap` is deprecated since go1.11 and the
`rec.Header()` method should be used instead. This commit
does this switch.

Found by https://staticcheck.io/ which was suggested by Fred,
thanks for this.
2022-08-16 20:40:54 +02:00
Samuele Pedroni
96b9a85fc2 daemon: stop exporting daemon.Resp in tests 2021-06-08 11:25:52 +02:00
Samuele Pedroni
8493ed9ebe daemon: streamline setup for auhtorized/unauthorized requests
add apiBaseSuite.asRootAuth/asUserAuth taking an *http.Request to
enhance with auth info

clean up some ineffective setup
2021-05-19 18:09:06 +02:00
James Henstridge
eebe1636b2 Merge remote-tracking branch 'upstream/master' into daemon-access-check 2021-04-07 17:02:42 +08:00
Samuele Pedroni
7aa0362582 daemon: introduce apiBaseSuite.(json|sync|async|error)Req
these test a daemon request and check the expected response type
before returning the response for further specific checks

this simplifies away some checks in the tests but the bigger win is
avoiding the .(*daemon.Resp) casts everywhere, in particular
this will reduce the number of affected places if we change
somewhat the internal types used to produce responses
2021-03-31 17:26:49 +02:00
James Henstridge
63be0de66e Merge remote-tracking branch 'upstream/master' into daemon-access-check 2021-03-18 12:15:16 +08:00
Samuele Pedroni
81e00c4488 daemon: switch api_asserts_test.go to apiBaseSuite
also avoid exporting Commands directly
2021-03-13 17:56:21 +01:00
Michael Vogt
1d3196ccb9 daemon: allow /v2/assertions/{assertType} to query store
This adds a new option "remote=true" to the
/v2/assertions/{assertType} endpoint. This will force
the daemon to search the store instead of the local asserts
database.

This will be needed for the `snap download <foo>` feature
that does the downloading via the snapd daemon.
2019-09-26 10:39:41 +02:00
Samuele Pedroni
8d533aaa90 introduce assertstest.AddMany and assertsstatetest.AddMany helpers
start using them
2019-05-09 08:51:05 +02:00
Samuele Pedroni
dd40909941 review feedback 2019-03-12 17:52:02 +01:00
Samuele Pedroni
a20f65f725 support returning assertion information as JSON with the "json" query parameter 2019-03-12 11:13:53 +01:00
Samuele Pedroni
55928a08d2 move the assertions endpoint tests to their own suite/test modules 2019-03-11 17:48:30 +01:00