github.com/hugh712/snapd@v0.0.0-20200910133618-1a99902bd583/snap/naming/wellknown_test.go (about) 1 // -*- Mode: Go; indent-tabs-mode: t -*- 2 3 /* 4 * Copyright (C) 2020 Canonical Ltd 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 3 as 8 * published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 package naming_test 21 22 import ( 23 . "gopkg.in/check.v1" 24 25 "github.com/snapcore/snapd/snap/naming" 26 ) 27 28 type wellKnownSuite struct{} 29 30 var _ = Suite(&wellKnownSuite{}) 31 32 func (s wellKnownSuite) TestWellKnownSnapID(c *C) { 33 c.Check(naming.WellKnownSnapID("foo"), Equals, "") 34 35 c.Check(naming.WellKnownSnapID("snapd"), Equals, "PMrrV4ml8uWuEUDBT8dSGnKUYbevVhc4") 36 37 c.Check(naming.WellKnownSnapID("core"), Equals, "99T7MUlRhtI3U0QFgl5mXXESAiSwt776") 38 c.Check(naming.WellKnownSnapID("core18"), Equals, "CSO04Jhav2yK0uz97cr0ipQRyqg0qQL6") 39 c.Check(naming.WellKnownSnapID("core20"), Equals, "DLqre5XGLbDqg9jPtiAhRRjDuPVa5X1q") 40 } 41 42 func (s wellKnownSuite) TestWellKnownSnapIDStaging(c *C) { 43 defer naming.UseStagingIDs(true)() 44 45 c.Check(naming.WellKnownSnapID("baz"), Equals, "") 46 47 c.Check(naming.WellKnownSnapID("snapd"), Equals, "Z44rtQD1v4r1LXGPCDZAJO3AOw1EDGqy") 48 49 c.Check(naming.WellKnownSnapID("core"), Equals, "xMNMpEm0COPZy7jq9YRwWVLCD9q5peow") 50 c.Check(naming.WellKnownSnapID("core18"), Equals, "NhSvwckvNdvgdiVGlsO1vYmi3FPdTZ9U") 51 // XXX no core20 uploaded to staging yet 52 c.Check(naming.WellKnownSnapID("core20"), Equals, "") 53 }