def server(): try: parm = {} for key in request.args: parm[key] = str(request.args[key]) result = RCube.dispatch(parm) return str(result) except Exception as e: return e
def test100_980_TestToSeeThatThereAreSameAmountOfColorsOnCube(self): inputParm = {'op': 'scramble', 'size': 2} result = RCube.dispatch(inputParm) finalResult = result['cube'] appearancesOf1 = finalResult.count(1) appearancesOf6 = finalResult.count(6) self.assertEquals(appearancesOf1, appearancesOf6)
def test101_001_ShouldReturnErrorDueToNoFace(self): inputParm = { 'op': 'rotate', 'cube': [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6 ] } result = RCube.dispatch(inputParm) self.assertEquals('error:', result['status'][0:6])
def test101_023_ShouldReturnStatusOfErrorOnCheckOnCubeOfIncorrectSize( self): #done inputParm = { 'op': 'check', 'cube': [ 2, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6 ] } result = RCube.dispatch(inputParm) self.assertEquals('error:', result['status'][0:6])
def test101_016_ShouldReturnStatusOfFullOnCheckOnEvenSizeCube(self): #done inputParm = { 'op': 'check', 'cube': [ 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6 ] } result = RCube.dispatch(inputParm) finalResult = result['status'] self.assertEquals('full', finalResult)
def test101_019_ShouldReturnStatusOfCrossesOnCheckOnOddSizeCubeSize3( self): #done inputParm = { 'op': 'check', 'cube': [ 2, 1, 2, 1, 1, 1, 2, 1, 2, 3, 2, 3, 2, 2, 2, 3, 2, 3, 4, 3, 4, 3, 3, 3, 4, 3, 4, 5, 4, 5, 4, 4, 4, 5, 4, 5, 6, 5, 6, 5, 5, 5, 6, 5, 6, 1, 6, 1, 6, 6, 6, 1, 6, 1 ] } result = RCube.dispatch(inputParm) finalResult = result['status'] self.assertEquals('crosses', finalResult)
def test101_021_ShouldReturnStatusOfUnknownOnCheckOnOddSizeCube( self): #done inputParm = { 'op': 'check', 'cube': [ 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6 ] } result = RCube.dispatch(inputParm) finalResult = result['status'] self.assertEquals('unknown', finalResult)
def test101_003_ShouldReturnRotatedAsStatus(self): inputParm = { 'op': 'rotate', 'cube': [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6 ], 'face': "F" } result = RCube.dispatch(inputParm) finalResult = result['status'] self.assertEquals('rotated', finalResult)
def test101_010_ShouldReturnRotatedCubeFaceD(self): inputParm = { 'op': 'rotate', 'cube': [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6 ], 'face': "D" } result = RCube.dispatch(inputParm) finalResult = result['cube'] cube = [ 1, 1, 1, 1, 1, 1, 4, 4, 4, 2, 2, 2, 2, 2, 2, 1, 1, 1, 3, 3, 3, 3, 3, 3, 2, 2, 2, 4, 4, 4, 4, 4, 4, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6 ] self.assertEquals(cube, finalResult)
def test101_013_ShouldReturnRotatedCubeFaceBbackwards(self): inputParm = { 'op': 'rotate', 'cube': [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 6, 2, 2, 6, 2, 2, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 4, 5, 4, 4, 5, 4, 4, 2, 2, 2, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 4, 4, 4 ], 'face': "B'" } result = RCube.dispatch(inputParm) finalResult = result['cube'] cube = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6 ] self.assertEquals(cube, finalResult)
def test100_990_TestToCheckThatThereIsACenterSquareForEveryColor(self): inputParm = {'size': 1, 'op': 'scramble'} result = RCube.dispatch(inputParm) self.assertEquals('error:', result['status'][0:6])
def test100_981_ShouldReturnStatusScrambled(self): inputParm = {'op': 'scramble', 'size': 2} result = RCube.dispatch(inputParm) finalResult = result['status'] self.assertEquals('scrambled', finalResult)
def test100_010_ShouldIndicateErrorConditionalMissingOp(self): inputParm = {} result = RCube.dispatch(inputParm) self.assertEquals('error:', result['status'][0:6])
def test100_970_ShouldReturnScrambledCubeBackwardsParm(self): inputParm = {'size': 2, 'op': 'scramble'} result = RCube.dispatch(inputParm) finalResult = result['cube'] self.assertEquals(len(finalResult), 2 * 2 * 6)
def test100_960_ShouldReturnErrorOfSizeTooSmall(self): inputParm = {'op': 'scramble', 'size': 1} result = RCube.dispatch(inputParm) self.assertEquals('error:', result['status'][0:6])
def test101_024_ShouldReturnStatusOfErrorOnCheckOnMissingCube(self): #done inputParm = {'op': 'check'} result = RCube.dispatch(inputParm) self.assertEquals('error:', result['status'][0:6])
def test100_020_ShouldIndicateErrorOpIsMissing(self): inputParm = {'op'} result = RCube.dispatch(inputParm) self.assertEquals('error:', result['status'][0:6])
def test100_ShouldReturnError(self): #queryString = "op=check&f=f&r=r&b=b&l=l&t=t&u=u&cube=f,f,f,t,f,f,f,f,f,r,r,r,r,r,r,r,r,r,b,u,b,b,b,b,b,b,b,l,l,l,l,l,l,l,l,l,t,t,t,f,t,t,t,t,t,u,u,u,b,u,u,u,u,u" parm = {'op':'check','f':'f', 'r':'r', 'b':'b','l':'l', 't':'t', 'u':'u', 'cube':'f,f,f,f,f,f,t,f,f,r,r,r,r,r,r,r,r,r,f,b,b,b,b,b,b,b,b,l,l,l,l,l,l,l,l,l,t,t,t,t,t,t,t,t,b,u,u,u,u,u,u,u,u,u'} RCube.dispatch(parm)
def test100_020_ShouldIndicateErrorOpIsSetToSomethingNotScramble(self): inputParm = {'op' == 'init'} result = RCube.dispatch(inputParm) self.assertEquals('error:', result['status'][0:6])
def test101_014_ShouldReturnScrambledCubeChecksForCenterFOrAllColorsOnOddSizeCube( self): #not done yet inputParm = {'op': 'scramble'} result = RCube.dispatch(inputParm) finalResult = result['cube'] self.assertEquals(len(finalResult), 3 * 3 * 6)
def test100_991_TestToCheckThatThereAreFourCornerForEachColor(self): inputParm = {'size': 1, 'op': 'scramble'} result = RCube.dispatch(inputParm) self.assertEquals('error:', result['status'][0:6])
def test100_940_ShouldReturnScrambledCubeOfSize30(self): inputParm = {'op': 'scramble', 'size': 30} result = RCube.dispatch(inputParm) finalResult = result['cube'] self.assertEquals(len(finalResult), 30 * 30 * 6)
def test100_920_ShouldReturnScrambledCubeOfSizeThreeMissingSize(self): inputParm = {'op': 'scramble'} result = RCube.dispatch(inputParm) finalResult = result['cube'] self.assertEquals(len(finalResult), 3 * 3 * 6)
def test900_ShouldReturnError(self): #queryString = "op=check&f=f&r=r&b=b&l=l&t=t&u=u&cube=f,f,f,t,f,f,f,f,f,r,r,r,r,r,r,r,r,r,b,u,b,b,b,b,b,b,b,l,l,l,l,l,l,l,l,l,t,t,t,f,t,t,t,t,t,u,u,u,b,u,u,u,u,u" parm = {'op':'scramble', 'n':'6', 'method':'transition'} RCube.dispatch(parm)
def test101_000_ShouldReturnErrorDueToNoCube(self): inputParm = {'op': 'rotate', 'face': "F"} result = RCube.dispatch(inputParm) self.assertEquals('error:', result['status'][0:6])