def test_insertList(): ##Tests to see if multiple Statements can be inserted tc = TinCan(USER_NAME,PASSWORD,ENDPOINT) statement1Id= str(uuid.uuid1()) statement2Id= str(uuid.uuid1()) email1 = 'mailto:[email protected]' email2 = 'mailto:[email protected]' email3 = 'mailto:[email protected]' x={'mbox':[email1]} y={'mbox':[email2,email3]} now = datetime.datetime.now() ##Builds statement list statementList = [{ "id": statement1Id, 'actor':{'name':['List Test1'],'mbox':[email1]}, 'verb':'passed', 'object':{'id':str(uuid.uuid1()),'definition':{'name':{"en-US":'you'},'description':{"en-US":'Testing list insertions[1] of statements.'}}} }, { "id": statement2Id, 'actor':{'name':['List Test2'],'mbox':[email2, email3]}, 'verb':'failed', 'object':{'id':str(uuid.uuid1()),'definition':{'name':{"en-US":'you'},'description':{"en-US":'Testing list insertions[1] of statements.'}}} }] tc.submitStatementList(statementList) time.sleep(10) ## Fetches previously entered statements state1 = tc.getStatementbyID(statement1Id) state2 = tc.getStatementbyID(statement2Id) ##Checks to see if the IDs are the same from inserted and retrieved assert state1['id'] == statement1Id assert state2['id'] == statement2Id
def test_submit_statement(): ##Tests to see if a single statement can be inserted tc = TinCan(USER_NAME,PASSWORD,ENDPOINT) statement_ID = str(uuid.uuid1()) whoDid = "I" whoDidEmail = "*****@*****.**" whoDidObject = 'you' didWhat = 'created' ##Build the Tin Can statement createdJsonObject ={ "id": statement_ID, 'actor':{'name':[whoDid],'mbox':['mailto:'+whoDidEmail]}, 'verb':didWhat, 'object':{'id':str(uuid.uuid1()),'definition':{'name':{"en-US":whoDidObject},'description':{"en-US":'Testing single insertion of a statement.'}}} } tc.submitStatement(createdJsonObject) ##Sleeps to insure the statement is inserted time.sleep(10) ##Gets the statement by the ID used when inserted testStatement = tc.getStatementbyID(statement_ID) ##Ensures the ID when inserted and the ID on the retrieve are the same assert (testStatement['id'] == statement_ID)