~abentley/simplestreams/fix-read-signed-no-check

« back to all changes in this revision

Viewing changes to tests/unittests/test_util.py

  • Committer: Aaron Bentley
  • Date: 2015-11-18 15:38:00 UTC
  • Revision ID: aaron.bentley@canonical.com-20151118153800-5v7kqfbjftbbnf32
Avoid "local variable 'cmd'" error when not checking.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
from simplestreams import util
3
3
 
4
4
from copy import deepcopy
 
5
import os
5
6
from unittest import TestCase
6
7
 
 
8
from tests.testutil import EXAMPLES_DIR
 
9
 
7
10
 
8
11
class TestProductsSet(TestCase):
9
12
    def test_product_exists(self):
139
142
        self.assertEqual(tree, otree)
140
143
 
141
144
 
 
145
class TestReadSigned(TestCase):
 
146
 
 
147
    def test_read_signed(self):
 
148
        path = os.path.join(EXAMPLES_DIR, 'foocloud/streams/v1/index.sjson')
 
149
        with open(path) as fileobj:
 
150
            util.read_signed(fileobj.read())
 
151
 
 
152
    def test_no_check(self):
 
153
        streams = os.path.join(EXAMPLES_DIR, 'foocloud/streams/v1')
 
154
        path = os.path.join(streams, 'index.sjson')
 
155
        with open(path) as fileobj:
 
156
            util.read_signed(fileobj.read(), checked=False)
 
157
 
 
158
 
142
159
class TestProductsCondense(TestCase):
143
160
    def test_condense_1(self):
144
161
        tree = {'products': {'P1': {'versions': {'1': {'A': 'B'},