# Path: macaroonbakery/tests/common.py
# class _StoppedClock(object):
# class OneIdentity(bakery.IdentityClient):
# class _NoOne(object):
# class ThirdPartyStrcmpChecker(bakery.ThirdPartyCaveatChecker):
# class ThirdPartyCheckerWithCaveats(bakery.ThirdPartyCaveatChecker):
# class ThirdPartyCaveatCheckerEmpty(bakery.ThirdPartyCaveatChecker):
#     def __init__(self, t):
#     def utcnow(self):
# def test_checker():
# def str_context(s):
# def str_check(ctx, cond, args):
# def true_check(ctx, cond, args):
#     def identity_from_context(self, ctx):
#     def declared_identity(self, ctx, declared):
#     def id(self):
#     def domain(self):
#     def __init__(self, str):
#     def check_third_party_caveat(self, ctx, cav_info):
#     def __init__(self, cavs=None):
#     def check_third_party_caveat(self, ctx, cav_info):
#     def check_third_party_caveat(self, ctx, cav_info):
# def new_bakery(location, locator=None):


import unittest
import macaroonbakery.bakery as bakery
import macaroonbakery.checkers as checkers
from macaroonbakery.tests import common
from pymacaroons.verifier import Verifier
# Copyright 2017 Canonical Ltd.
# Licensed under the LGPLv3, see LICENCE file for details.



def always_ok(predicate):
    return True


class TestDischargeAll(unittest.TestCase):
    def test_discharge_all_no_discharges(self):
        root_key = b'root key'
        m = bakery.Macaroon(
            root_key=root_key, id=b'id0', location='loc0',
            version=bakery.LATEST_VERSION,
            namespace=common.test_checker().namespace())
        ms = bakery.discharge_all(m, no_discharge(self))
        self.assertEqual(len(ms), 1)
        self.assertEqual(ms[0], m.macaroon)
        v = Verifier()
        v.satisfy_general(always_ok)
        v.verify(m.macaroon, root_key, None)

    def test_discharge_all_many_discharges(self):
        root_key = b'root key'
        m0 = bakery.Macaroon(
            root_key=root_key, id=b'id0', location='loc0',

# Path: macaroonbakery/tests/common.py
# class _StoppedClock(object):
# class OneIdentity(bakery.IdentityClient):
# class _NoOne(object):
# class ThirdPartyStrcmpChecker(bakery.ThirdPartyCaveatChecker):
# class ThirdPartyCheckerWithCaveats(bakery.ThirdPartyCaveatChecker):
# class ThirdPartyCaveatCheckerEmpty(bakery.ThirdPartyCaveatChecker):
#     def __init__(self, t):
#     def utcnow(self):
# def test_checker():
# def str_context(s):
# def str_check(ctx, cond, args):
# def true_check(ctx, cond, args):
#     def identity_from_context(self, ctx):
#     def declared_identity(self, ctx, declared):
#     def id(self):
#     def domain(self):
#     def __init__(self, str):
#     def check_third_party_caveat(self, ctx, cav_info):
#     def __init__(self, cavs=None):
#     def check_third_party_caveat(self, ctx, cav_info):
#     def check_third_party_caveat(self, ctx, cav_info):
# def new_bakery(location, locator=None):


# Path: macaroonbakery/tests/test_discharge_all.py
import unittest
import macaroonbakery.bakery as bakery
import macaroonbakery.checkers as checkers
from macaroonbakery.tests import common
from pymacaroons.verifier import Verifier

# Copyright 2017 Canonical Ltd.
# Licensed under the LGPLv3, see LICENCE file for details.



def always_ok(predicate):
    return True


class TestDischargeAll(unittest.TestCase):
    def test_discharge_all_no_discharges(self):
        root_key = b'root key'
        m = bakery.Macaroon(
            root_key=root_key, id=b'id0', location='loc0',
            version=bakery.LATEST_VERSION,
            namespace=common.test_checker().namespace())
        ms = bakery.discharge_all(m, no_discharge(self))
        self.assertEqual(len(ms), 1)
        self.assertEqual(ms[0], m.macaroon)
        v = Verifier()
        v.satisfy_general(always_ok)
        v.verify(m.macaroon, root_key, None)

    def test_discharge_all_many_discharges(self):
        root_key = b'root key'
        m0 = bakery.Macaroon(
            root_key=root_key, id=b'id0', location='loc0',

            version=bakery.LATEST_VERSION)