def test_Webinterface_template_with_default(self): """test_Webinterface_template_with_default TC6-A Kan importere default template med argument "default" """ self.webschema2 = JsonControl() jsonSchema = self.webschema2.getTemplate("default") self.webschema2.validateTemplate(jsonSchema)
def test_Will_Fail_unKnown_Template(self): """test_Will_Fail_unKnown_Template TC2-A Accepterer kun kendte templates """ unknownTemplate = "unknown.json" self.unknown_Template = JsonControl() Template = self.unknown_Template.getTemplate(unknownTemplate) self.assertIs(Template, "failed")
def test_Can_Import_Known_Template(self): """test_Can_Import_Known_Template TC1-A Kan importere template """ knownTemplate = settings.defaultJsonTemplate self.known_Template = JsonControl() self.known_Template.getTemplate(knownTemplate) self.assertTrue(self.known_Template, True)
def __init__(self, master): self.cjsonSchema = JsonControl() self.datactrl = DataControl() content = Frame(root) content.grid() # Program "Main" Header self.lb_prgHeader = Label( content, text=txt_programTitle, font=f_header1, ) self.lb_prgHeader.grid(row=0, column=0, columnspan=4, sticky=(N, E, W)) # Button: Start Test self.bt_startTest = Button( content, text="Start Test", font=f_normal, command=self.startTest) self.bt_startTest.grid(row=5, column=0) # Button: Initialize Template self.bt_usetemplate = Button( content, text="Use Template", font=f_normal, command=self.setTemplate) self.bt_usetemplate.grid(row=1, column=0) # Entry: Template self.entry_template = Entry( content, width=16) self.entry_template.grid(row=1, column=1, columnspan=3) self.entry_template.insert(0, settings.defaultJsonTemplate) # Button: Quit Program self.bt_quitProgram = Button( content, text="Quit", font=f_normal, command=content.quit) self.bt_quitProgram.grid(row=6, column=3, sticky=(S, E)) # Label: Receive Data self.lb_rxData = Label(content, text="Received Data", font=f_normal) self.lb_rxData.grid(row=4, column=1) # Entry: Receive Data self.entry_rxData = Entry( content, width=12) self.entry_rxData.grid(row=5, column=1)
def readGPIOpin(pin): # pin format = P8_XX """readGPIOpin retrieves current state of a GPIO pin per request """ spin = str(pin) GPIO.setup(spin, GPIO.IN) if GPIO.input(spin): settings.msgType = "status" settings.commandList = "GPIO Pin " + spin + " is HIGH" else: settings.msgType = "status" settings.commandList = "GPIO Pin " + spin + " is LOW" # We must instantiate a JSON template object to be able to start test etc. JsonWorker = JsonControl() JsonWorker.getTemplate("default") def getTestResult(): """getTestResult will handle request for test actions. Meaning it will initiate a given test action eg. setGPIOpin "P8_11" "HIGH" """ if settings.statusCode == "Busy": print("Schema for deserialize = %s" % settings.str_rxData_ser) JsonSchema = JsonWorker.deSerialize(settings.str_rxData_ser) JsonWorker.getValues(JsonSchema) if settings.msgType == "command": if settings.commandList == "readGPIO_P8_11": readGPIOpin("P8_11") if settings.commandList == "setGPIO_P8_11H":
def setUp(self): self.webschema = JsonControl() self.webschema.getTemplate(webSchema)
def setUp(self): self.refschema = JsonControl() self.refschema.getTemplate(refSchema)
def setUp(self): self.webschema = JsonControl() self.jsonSchema = self.webschema.getTemplate("default")
def __init__(self): self.cjsonSchema = JsonControl() return