# Path: errors.py
# class NoSuchSecret(Exception):
#     pass
# 
# Path: logic/secret.py
# def get_secret(id):
#     secret = Secret.get_by_id(id)
#     if secret:
#         return secret.value
#     else:
#         raise NoSuchSecret(id)
# 
# Path: testing/factories/secret.py
# def create_secret(id, value='secret'):
#     secret = Secret(id=id, value=value)
#     secret.put()
#     return secret


import unittest
from errors import NoSuchSecret
from logic.secret import get_secret
from testing.factories import create_secret
# -*- coding: utf-8 -*-



class SecretTest(unittest.TestCase):
    nosegae_datastore_v3 = True

    def test_existing_secret(self):
        create_secret('FOO', value='bar')
        self.assertEqual('bar', get_secret('FOO'))

    def test_unknown_secret(self):
        with self.assertRaises(NoSuchSecret):

# Path: errors.py
# class NoSuchSecret(Exception):
#     pass
# 
# Path: logic/secret.py
# def get_secret(id):
#     secret = Secret.get_by_id(id)
#     if secret:
#         return secret.value
#     else:
#         raise NoSuchSecret(id)
# 
# Path: testing/factories/secret.py
# def create_secret(id, value='secret'):
#     secret = Secret(id=id, value=value)
#     secret.put()
#     return secret


# Path: tests/logic/secret_test.py
import unittest
from errors import NoSuchSecret
from logic.secret import get_secret
from testing.factories import create_secret

# -*- coding: utf-8 -*-



class SecretTest(unittest.TestCase):
    nosegae_datastore_v3 = True

    def test_existing_secret(self):
        create_secret('FOO', value='bar')
        self.assertEqual('bar', get_secret('FOO'))

    def test_unknown_secret(self):
        with self.assertRaises(NoSuchSecret):

            get_secret('THANKS_FOR_ALL_THE_FISH')