Ejemplo n.º 1
0
def test_assignment_json_serde():
    asns = Assignments('test', 8, tp1, 12345, 1)
    jsonOut = asns.asJson()
    print(jsonOut)
    asnsDeser = Assignments.fromJson(jsonOut)

    assert asns.version == asnsDeser.version
    assert asns.group == asnsDeser.group
    assert asns.maxMembers == asnsDeser.maxMembers
    assert asns.configVersion == asnsDeser.configVersion
    assert len(asns.memberAssignments) == len(asnsDeser.memberAssignments)
    assert len(asns.topics) == len(asnsDeser.topics)
Ejemplo n.º 2
0
 def _processAssignmentsData(self, rawData):
     if rawData is not None:
         return Assignments.fromJson(rawData.decode('utf-8'))
Ejemplo n.º 3
0
def test_assignment_json_bad_input(jsonStr):
    rs = Assignments.fromJson(jsonStr)
    assert rs is None
Ejemplo n.º 4
0
def test_assignment_json_bad():
    rs = Assignments.fromJson('{some: bad json}')
    assert rs is None
Ejemplo n.º 5
0
def assignments():
    return Assignments.fromJson(good_assignment_json)