def test_handle_fetchobject(self): obj = self.station.station.write("foobarbazlulz") self.station.payload = obj handle_fetchobject(self.station) response = self.station.stream.pop() pb_obj = GitObject() pb_obj.ParseFromString(response.payload) self.assertEqual(pb_obj.type, pygit2.GIT_OBJ_BLOB) self.assertEqual(pb_obj.data, "foobarbazlulz")
def test_handle_terminate(self): # Write an object into the station self.station.set_real_id(True) oid = self.station.station.write("butts lol") self.station.payload = oid self.assertEqual(len(self.station.station.registry.contents), 0) self.station.station.register_request(self.station) self.assertEqual(len(self.station.station.registry.contents), 1) handle_fetchobject(self.station) ret = [0] def _teardown(): ret[0] += 1 self.station.teardown = _teardown term = self.station.stream.pop() handle_terminate(term) self.assertEqual(len(self.station.station.registry.contents), 0) self.assertEqual(ret[0], 1)