def test_add_mpg_file(): """Add an mpg file, make sure it's viewable. Add an example MPG movie file, make sure it's viewable in slick with the appropriate viewer. :component: File Upload :author: Jason Corbett :steps: 1. Add a .mpg movie file to slick. :expectedResults: 1. File is viewable in slick. """ mpg_file = "example.mpg" snot.add_file(mpg_file)
def add_file_test(): """This test will add this python file to the result Add a file using snot's add_file(path) method. Will require manual validation that the file was uploaded. :component: File Upload :author: Jason Corbett :steps: 1. Call snot's add_file function with the path to the current file :expectedResults: 1. The current python source file should be uploaded """ this_file = __file__ if this_file.endswith('pyc'): this_file = this_file.strip('c') snot.add_file(this_file)
def test_add_log_file(): """Add a log file, make sure it's viewable. Log files need to be added with the mimetype text/plain. This posts such a file to make sure that works properly. :component: File Upload :author: Jason Corbett :steps: 1. Add a .log file with text in it to slick. :expectedResults: 1. File is viewable in slick. """ log_file = "example.log" with open(log_file, 'w') as log: log.writelines(["This is an example log file", "with 2 lines in it."]) snot.add_file(log_file)
def test_add_xml_file(): """Add an xml file, make sure it's viewable. XML files need to be added with the mimetype application/xml. This posts such a file to make sure that works properly, and is viewable in slick. :component: File Upload :author: Jason Corbett :steps: 1. Add a .xml file with xml in it to slick. :expectedResults: 1. File is viewable in slick (and syntax highlighted). """ xml_file = "example.xml" with open(xml_file, 'w') as xml: xml.writelines(['<?xml version="1.0" encoding="UTF-8"?>\n', '<notes>\n', ' <note>Sample XML File</note>\n', '</notes>\n']) snot.add_file(xml_file)
def test_something(): """Test Something This is the test description, while the "Test Something" from above will be the test name in slick. Below are slick attributes. :component: Example Module One :feature: Example Feature One :author: Jason Corbett :steps: 1. Log where we are at. 2. Attach this file to the result """ logger = logging.getLogger("testlauncher.grouping.suitea.testmodfirst.test_something") logger.debug("Inside testcase") this_file = __file__ if this_file.endswith('pyc'): this_file = this_file.strip('c') snot.add_file(this_file) time.sleep(1)