def test_addMember_good(self): nc = NetworkController() data = { "id": "a", "name": "b", "address": "c", "city": "d", "state": "e", "zip": "f", "status": consts.STATUS_UNBANNED } nc.truncateMembers("AS62ELRB5F0709LERPHZD06JWC0P8QSC") response = nc.addMember("AS62ELRB5F0709LERPHZD06JWC0P8QSC", data) self.assertEqual(response.error, consts.NO_ERROR) response = nc.getAllMembers("AS62ELRB5F0709LERPHZD06JWC0P8QSC") self.assertEqual(response.error, consts.NO_ERROR) self.assertEqual(len(response.payload), 1) self.assertEqual( response.payload[0], { "id": "a", "name": "b", "address": "c", "city": "d", "state": "e", "zip": "f", "status": consts.STATUS_UNBANNED })
def test_truncateMembers_good(self): nc = NetworkController() key = "AS62ELRB5F0709LERPHZD06JWC0P8QSC" response = nc.truncateMembers(key) self.assertEqual(response.error, consts.NO_ERROR) response = nc.getAllMembers(key) self.assertEqual(response.error, consts.NO_ERROR) self.assertEqual(len(response.payload), 0)
def test_getAllMembers_lots(self): nc = NetworkController() nc.truncateMembers("AS62ELRB5F0709LERPHZD06JWC0P8QSC") for i in range(0, 9): nc.addMember( "AS62ELRB5F0709LERPHZD06JWC0P8QSC", { "id": str(i), "name": "b", "address": "c", "city": "d", "state": "e", "zip": "f", "status": consts.STATUS_UNBANNED }) response = nc.getAllMembers("AS62ELRB5F0709LERPHZD06JWC0P8QSC") print(response.serialize())