Esempio n. 1
0
    def test_check_protobuf_using_protoc_positive(self, mocked_try_run_protoc):
        """Positive test for the 'check_protobuf_using_protoc' method"""
        protocol_name = "protocol_name"
        file_name = protocol_name + "_pb2.py"

        new_file = open(os.path.join(self.t, file_name), "w+")
        new_file.close()
        result, msg = check_protobuf_using_protoc(self.t, protocol_name)

        assert not Path(self.t, file_name).exists()
        assert result is True
        assert msg == "protobuf file is valid"
Esempio n. 2
0
 def test_check_protobuf_using_protoc_nagative(self, mocked_subprocess):
     """Negative test for the 'check_protobuf_using_protoc' method: protoc has some errors"""
     result, msg = check_protobuf_using_protoc("some_path", "name")
     assert result is False
     assert msg == "some_protoc_error"