Skip to content

Commit

Permalink
start of the output facard testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen Synge committed Jul 6, 2014
1 parent e6b6372 commit b3160e7
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 6 deletions.
82 changes: 82 additions & 0 deletions test/test_vmcatcher_outputfacard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import vmcatcher.vmcatcher_subscribe.retrieveFacard
import logging
import smimeX509validation
import unittest

import vmcatcher.outputfacard

from vmcatcher.vmcatcher_subscribe.fatcontroler import db_controler


class TestOutputFacard(unittest.TestCase):
def setUp(self):
self.outputfacard = vmcatcher.outputfacard.outputFacade()
self.outputfacard.fpOutput = "/dev/null"


# make in memorrydb
databaseConnectionString = 'sqlite://'
database = db_controler(databaseConnectionString,False)
Session = database.SessionFactory()


self.outputfacard.saSession = Session
self.outputfacard.format = "lines"

def tearDown(self):
pass
def test_format_set_lines(self):
self.outputfacard.format = "lines"

def test_format_set_json(self):
self.outputfacard.format = "json"

def test_format_set_json(self):
self.outputfacard.format = "message"

def test_format_set_smime(self):
self.outputfacard.format = "SMIME"

def test_format_set_bad(self):
def assign_bad_name():
self.outputfacard.format = "bad"
self.assertRaises(vmcatcher.outputfacard.outputFacadeException, assign_bad_name)

def test_list_vmcatcher_subscribe(self):
self.outputfacard.list_vmcatcher_subscribe()

def test_list_vmcatcher_endorser_cred(self):
self.outputfacard.list_vmcatcher_endorser_cred()

def test_list_vmcatcher_endorser_link(self):
self.outputfacard.list_vmcatcher_endorser_link()

def test_list_vmcatcher_image(self):
self.outputfacard.list_vmcatcher_image()

@unittest.skip("not finsihed")
def test_display_subscription(self):
self.outputfacard.display_subscription("dfsdfsdf")
@unittest.skip("not finsihed")
def test_display_endorser(self):
self.display_endorseroutputfacard.display_endorser("dfsdfsdf")
@unittest.skip("not finsihed")
def test_display_imagedef(self):
self.outputfacard.display_imagedef("dfsdfsdf")

def test_info(self):
self.outputfacard.info()



def test_lines(self):
pass
def test_json(self):
pass
def test_smime(self):
pass
def test_message(self):
pass



16 changes: 10 additions & 6 deletions vmcatcher/outputfacard.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ def Property(func):



class Error(Exception):
class outputFacadeException(Exception):
"""Base class for exceptions in this module."""
pass

class outputFacadeInputError(Error):
class outputFacadeInputError(outputFacadeException):
"""Exception raised for errors in the input.
Attributes:
Expand All @@ -44,7 +44,10 @@ def fget(self):
if self._uploaderImp != None:
if hasattr(self._uploaderImp,'fpOutput'):
return self._uploaderImp.fpOutput
return self._fpOutput
if hasattr(self,'_fpOutput'):
return self._fpOutput
else:
return None

def fset(self, name):
self._fpOutput = name
Expand All @@ -56,7 +59,7 @@ def fdel(self):
return locals()
@Property
def saSession():
doc = "Ouput File Pointer"
doc = "SQL alchamy session."
def fget(self):
if hasattr(self, '_uploaderImp'):
if self._uploaderImp != None:
Expand All @@ -74,7 +77,7 @@ def fdel(self):
return locals()
@Property
def x509anchor():
doc = "Ouput File Pointer"
doc = "x509 achor"
def fget(self):
if hasattr(self, '_uploaderImp'):
if self._uploaderImp != None:
Expand All @@ -101,9 +104,10 @@ def fget(self):
return None
def fset(self, name):
if not name in availableFormats:
self.log.error("asdsdasd")
del(self._uploaderImp)
del(self._outputFormatName)
error = InputError("Invalid Value")
error = outputFacadeInputError("Invalid Value")
raise error
self._outputFormatName = name
new_implementation_ptr = {'SMIME' : output_driver_smime,
Expand Down

0 comments on commit b3160e7

Please sign in to comment.