~jcsackett/charmworld/bac-tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/tests/test_models.py

  • Committer: Tarmac
  • Author(s): Brad Crittenden
  • Date: 2013-07-18 19:23:09 UTC
  • mfrom: (313.1.6 bundle-api)
  • Revision ID: tarmac-20130718192309-gpskenwvljiy47em
[r=sinzui][bug=][author=bac] Minimal implementation of API for fetching bundles.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1222
1222
        bundle1 = Bundle(
1223
1223
            {'name': 'tiny',
1224
1224
             'owner': 'bac',
1225
 
             'basket': 'apache',
 
1225
             'basket': 'apache-1',
1226
1226
             'inherits': 'big-apache',
1227
1227
             })
1228
1228
        bundle2 = Bundle(
1229
1229
            {'name': 'tiny',
1230
1230
             'owner': 'bac',
1231
 
             'basket': 'apache',
 
1231
             'basket': 'apache-1',
1232
1232
             'inherits': 'moderately-big-apache',
1233
1233
             'branch_deleted': True,
1234
1234
             })
1238
1238
        bundle1 = Bundle(
1239
1239
            {'name': 'tiny',
1240
1240
             'owner': 'bac',
1241
 
             'basket': 'apache',
 
1241
             'basket': 'apache-4',
1242
1242
             })
1243
1243
        bundle2 = Bundle(
1244
1244
            {'name': 'tiny',
1245
1245
             'owner': 'abc',
1246
 
             'basket': 'apache',
 
1246
             'basket': 'apache-4',
1247
1247
             })
1248
1248
        self.assertNotEqual(bundle1, bundle2)
1249
1249
 
1250
 
    def test_id_mit_owner(self):
1251
 
        bundle = Bundle(
1252
 
            {'name': 'tiny',
1253
 
             'owner': 'bac',
1254
 
             'basket': 'apache',
1255
 
             })
1256
 
        self.assertEqual(
1257
 
            "~bac/apache/tiny", bundle.id)
1258
 
 
1259
 
    def test_id_sans_owner(self):
1260
 
        bundle = Bundle(
1261
 
            {'name': 'tiny',
1262
 
             'owner': '',
1263
 
             'basket': 'apache',
1264
 
             })
1265
 
        self.assertEqual(
1266
 
            "apache/tiny", bundle.id)
1267
 
 
1268
 
    def test_perm_url_mit_owner(self):
1269
 
        bundle = Bundle(
1270
 
            {'name': 'tiny',
1271
 
             'owner': 'bac',
1272
 
             'basket': 'apache',
1273
 
             })
1274
 
        self.assertEqual(
1275
 
            "jc:~bac/apache/tiny", bundle.permanent_url)
1276
 
 
1277
 
    def test_perm_url_sans_owner(self):
1278
 
        bundle = Bundle(
1279
 
            {'name': 'tiny',
1280
 
             'owner': '',
1281
 
             'basket': 'apache',
1282
 
             })
1283
 
        self.assertEqual(
1284
 
            "jc:apache/tiny", bundle.permanent_url)
 
1250
    def test_id(self):
 
1251
        bundle = Bundle(
 
1252
            {'name': 'tiny',
 
1253
             'owner': 'bac',
 
1254
             'basket': 'apache-8',
 
1255
             })
 
1256
        self.assertEqual(
 
1257
            "~bac/apache-8/tiny", bundle.id)
 
1258
 
 
1259
    def test_perm_url(self):
 
1260
        bundle = Bundle(
 
1261
            {'name': 'tiny',
 
1262
             'owner': 'bac',
 
1263
             'basket': 'apache-6',
 
1264
             })
 
1265
        self.assertEqual(
 
1266
            "jc:~bac/apache-6/tiny", bundle.permanent_url)