Coverage for tests/publisher/snaps/test_logic.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1import unittest
3from webapp.publisher.snaps import logic
6class LogicTest(unittest.TestCase):
7 def test_get_snap_names_by_ownership(self):
8 account_info = {
9 "username": "toto",
10 "snaps": {
11 "16": {
12 "test": {
13 "status": "Approved",
14 "snap-id": "1",
15 "snap-name": "test",
16 "publisher": {"username": "toto"},
17 "latest_revisions": [
18 {
19 "test": "test",
20 "since": "2018-01-01T00:00:00Z",
21 "channels": [],
22 }
23 ],
24 },
25 "test2": {
26 "status": "Approved",
27 "snap-id": "2",
28 "snap-name": "test2",
29 "publisher": {"username": "titi"},
30 "latest_revisions": [
31 {
32 "test": "test",
33 "since": "2018-01-01T00:00:00Z",
34 "channels": [],
35 }
36 ],
37 },
38 }
39 },
40 }
42 owned, shared = logic.get_snap_names_by_ownership(account_info)
43 self.assertListEqual(owned, ["test"])
44 self.assertListEqual(shared, ["test2"])