# Path: bein/util.py
# @program
# def touch(filename = None):
#     """Equivalent to shell: ``touch filename``
# 
#     Returns *filename*.  If filename is ``None``, *filename* is set to
#     a unique, random name.
#     """
#     if filename == None:
#         filename = unique_filename_in()
#     return {"arguments": ["touch",filename],
#             "return_value": filename}


import socket
import re
import sys
import random
from unittest2 import TestCase, TestSuite, main, TestLoader, skipIf
from bein import *
from bein.util import touch
            self.assertRaises(ValueError, f.wait)

class TestImmutabilityDropped(TestCase):
    def test_immutability_dropped(self):
        executions = []
        with execution(M) as ex:
            touch(ex, "boris")
            ex.add("boris")

        exid1 = ex.id
        borisid = M.search_files(source=('execution',ex.id))[0]
        self.assertFalse(M.fetch_file(borisid)['immutable'])

        with execution(M) as ex:
            ex.use(borisid)

        exid2 = ex.id
        self.assertTrue(M.fetch_file(borisid)['immutable'])

        M.delete_execution(exid2)
        self.assertFalse(M.fetch_file(borisid)['immutable'])

        M.delete_execution(exid1)
        self.assertEqual(M.search_files(source=('execution',exid1)), [])

class TestAssociatePreservesFilenames(TestCase):
    def test_associate_with_names(self):
        try:
            with execution(M) as ex:
                touch(ex, "boris")

# Path: bein/util.py
# @program
# def touch(filename = None):
#     """Equivalent to shell: ``touch filename``
# 
#     Returns *filename*.  If filename is ``None``, *filename* is set to
#     a unique, random name.
#     """
#     if filename == None:
#         filename = unique_filename_in()
#     return {"arguments": ["touch",filename],
#             "return_value": filename}


# Path: bein/tests/test_bein.py
import socket
import re
import sys
import random
from unittest2 import TestCase, TestSuite, main, TestLoader, skipIf
from bein import *
from bein.util import touch

            self.assertRaises(ValueError, f.wait)

class TestImmutabilityDropped(TestCase):
    def test_immutability_dropped(self):
        executions = []
        with execution(M) as ex:
            touch(ex, "boris")
            ex.add("boris")

        exid1 = ex.id
        borisid = M.search_files(source=('execution',ex.id))[0]
        self.assertFalse(M.fetch_file(borisid)['immutable'])

        with execution(M) as ex:
            ex.use(borisid)

        exid2 = ex.id
        self.assertTrue(M.fetch_file(borisid)['immutable'])

        M.delete_execution(exid2)
        self.assertFalse(M.fetch_file(borisid)['immutable'])

        M.delete_execution(exid1)
        self.assertEqual(M.search_files(source=('execution',exid1)), [])

class TestAssociatePreservesFilenames(TestCase):
    def test_associate_with_names(self):
        try:
            with execution(M) as ex:
                touch(ex, "boris")

                touch(ex, "hilda")